32 lines
885 B
JavaScript
32 lines
885 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
|
|
) {
|
|
|
|
R3.D3.API.Viewport.call(
|
|
this,
|
|
apiComponent
|
|
);
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.aspectRatio)) {
|
|
apiComponent.aspectRatio = R3.D3.API.Viewport.ASPECT_RATIO_16_9;
|
|
}
|
|
this.aspectRatio = apiComponent.aspectRatio;
|
|
|
|
};
|
|
|
|
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;
|