r3-legacy/src/r3-d3-api-viewport-fixedAsp...

39 lines
1007 B
JavaScript

/**
* R3.D3.API.Viewport.FixedAspect
*
* Respect the aspectRatio setting and adjust viewport x,y,width and height accordingly
* - entire viewport remains visible at all times
* - will have empty space above or below viewport depending on canvas size (if canvas ratio != viewport ratio)
*
* @param apiComponent
*
* @property aspectRatio
*
* @constructor
*/
R3.D3.API.Viewport.FixedAspect = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.aspectRatio)) {
apiComponent.aspectRatio = R3.D3.API.Viewport.ASPECT_RATIO_1_1;
}
this.aspectRatio = apiComponent.aspectRatio;
this.guiInfo.aspectRatio = {
range: [0, 4],
step: 0.0001,
dp: 4
};
R3.D3.API.Viewport.call(
this,
apiComponent
);
};
R3.D3.API.Viewport.FixedAspect.prototype = Object.create(R3.D3.API.Viewport.prototype);
R3.D3.API.Viewport.FixedAspect.prototype.constructor = R3.D3.API.Viewport.FixedAspect;