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

Method change

systemvm/agent/noVNC/core/util/cursor.js:80–106  ·  view source on GitHub ↗
(rgba, hotx, hoty, w, h)

Source from the content-addressed store, hash-verified

78 }
79
80 change(rgba, hotx, hoty, w, h) {
81 if ((w === 0) || (h === 0)) {
82 this.clear();
83 return;
84 }
85
86 this._position.x = this._position.x + this._hotSpot.x - hotx;
87 this._position.y = this._position.y + this._hotSpot.y - hoty;
88 this._hotSpot.x = hotx;
89 this._hotSpot.y = hoty;
90
91 let ctx = this._canvas.getContext('2d');
92
93 this._canvas.width = w;
94 this._canvas.height = h;
95
96 let img = new ImageData(new Uint8ClampedArray(rgba), w, h);
97 ctx.clearRect(0, 0, w, h);
98 ctx.putImageData(img, 0, 0);
99
100 if (useFallback) {
101 this._updatePosition();
102 } else {
103 let url = this._canvas.toDataURL();
104 this._target.style.cursor = 'url(' + url + ')' + hotx + ' ' + hoty + ', default';
105 }
106 }
107
108 clear() {
109 this._target.style.cursor = 'none';

Callers 4

bootstrap.jsFile · 0.45
bootstrap.min.jsFile · 0.45
cloud.logger.jsFile · 0.45
_refreshCursorMethod · 0.45

Calls 4

clearMethod · 0.95
_updatePositionMethod · 0.95
getContextMethod · 0.65
toDataURLMethod · 0.45

Tested by

no test coverage detected