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

Method autoscale

systemvm/agent/noVNC/core/display.js:432–452  ·  view source on GitHub ↗
(containerWidth, containerHeight)

Source from the content-addressed store, hash-verified

430 }
431
432 autoscale(containerWidth, containerHeight) {
433 let scaleRatio;
434
435 if (containerWidth === 0 || containerHeight === 0) {
436 scaleRatio = 0;
437
438 } else {
439
440 const vp = this._viewportLoc;
441 const targetAspectRatio = containerWidth / containerHeight;
442 const fbAspectRatio = vp.w / vp.h;
443
444 if (fbAspectRatio >= targetAspectRatio) {
445 scaleRatio = containerWidth / vp.w;
446 } else {
447 scaleRatio = containerHeight / vp.h;
448 }
449 }
450
451 this._rescale(scaleRatio);
452 }
453
454 // ===== PRIVATE METHODS =====
455

Callers 1

_updateScaleMethod · 0.80

Calls 1

_rescaleMethod · 0.95

Tested by

no test coverage detected