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

Method viewportChangeSize

systemvm/agent/noVNC/core/display.js:134–173  ·  view source on GitHub ↗
(width, height)

Source from the content-addressed store, hash-verified

132 }
133
134 viewportChangeSize(width, height) {
135
136 if (!this._clipViewport ||
137 typeof(width) === "undefined" ||
138 typeof(height) === "undefined") {
139
140 Log.Debug("Setting viewport to full display region");
141 width = this._fbWidth;
142 height = this._fbHeight;
143 }
144
145 width = Math.floor(width);
146 height = Math.floor(height);
147
148 if (width > this._fbWidth) {
149 width = this._fbWidth;
150 }
151 if (height > this._fbHeight) {
152 height = this._fbHeight;
153 }
154
155 const vp = this._viewportLoc;
156 if (vp.w !== width || vp.h !== height) {
157 vp.w = width;
158 vp.h = height;
159
160 const canvas = this._target;
161 canvas.width = width;
162 canvas.height = height;
163
164 // The position might need to be updated if we've grown
165 this.viewportChangePos(0, 0);
166
167 this._damage(vp.x, vp.y, vp.w, vp.h);
168 this.flip();
169
170 // Update the visible size of the target canvas
171 this._rescale(this._scale);
172 }
173 }
174
175 absX(x) {
176 if (this._scale === 0) {

Callers 3

clipViewportMethod · 0.95
resizeMethod · 0.95
_updateClipMethod · 0.80

Calls 4

viewportChangePosMethod · 0.95
_damageMethod · 0.95
flipMethod · 0.95
_rescaleMethod · 0.95

Tested by

no test coverage detected