MCPcopy Create free account
hub / github.com/apache/cloudstack / _handleMouseUp

Method _handleMouseUp

systemvm/agent/noVNC/core/util/cursor.js:160–189  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

158 }
159
160 _handleMouseUp(event) {
161 // We might get this event because of a drag operation that
162 // moved outside of the target. Check what's under the cursor
163 // now and adjust visibility based on that.
164 let target = document.elementFromPoint(event.clientX, event.clientY);
165 this._updateVisibility(target);
166
167 // Captures end with a mouseup but we can't know the event order of
168 // mouseup vs releaseCapture.
169 //
170 // In the cases when releaseCapture comes first, the code above is
171 // enough.
172 //
173 // In the cases when the mouseup comes first, we need wait for the
174 // browser to flush all events and then check again if the cursor
175 // should be visible.
176 if (this._captureIsActive()) {
177 window.setTimeout(() => {
178 // We might have detached at this point
179 if (!this._target) {
180 return;
181 }
182 // Refresh the target from elementFromPoint since queued events
183 // might have altered the DOM
184 target = document.elementFromPoint(event.clientX,
185 event.clientY);
186 this._updateVisibility(target);
187 }, 0);
188 }
189 }
190
191 _showCursor() {
192 if (this._canvas.style.visibility === 'hidden') {

Callers

nothing calls this directly

Calls 3

_updateVisibilityMethod · 0.95
_captureIsActiveMethod · 0.95
setTimeoutMethod · 0.65

Tested by

no test coverage detected