Issue #305 : Allow DrawingController to zoom out to real size

This commit is contained in:
jdescottes
2015-09-13 22:44:59 +02:00
parent 089b4ea14d
commit 1fe327495c
3 changed files with 32 additions and 16 deletions

View File

@@ -75,18 +75,24 @@
};
ns.FrameRenderer.prototype.setZoom = function (zoom) {
if (zoom > Constants.MINIMUM_ZOOM) {
// back up center coordinates
var centerX = this.offset.x + (this.displayWidth / (2 * this.zoom));
var centerY = this.offset.y + (this.displayHeight / (2 * this.zoom));
this.zoom = zoom;
// recenter
this.setOffset(
centerX - (this.displayWidth / (2 * this.zoom)),
centerY - (this.displayHeight / (2 * this.zoom))
);
if (zoom < Constants.MINIMUM_ZOOM) {
zoom = Constants.MINIMUM_ZOOM;
}
if (zoom == this.zoom) {
return;
}
// back up center coordinates
var centerX = this.offset.x + (this.displayWidth / (2 * this.zoom));
var centerY = this.offset.y + (this.displayHeight / (2 * this.zoom));
this.zoom = zoom;
// recenter
this.setOffset(
centerX - (this.displayWidth / (2 * this.zoom)),
centerY - (this.displayHeight / (2 * this.zoom))
);
};
ns.FrameRenderer.prototype.getZoom = function () {