Refactor properties into methods for canvas

This commit is contained in:
Erik Tiekstra
2017-05-12 10:24:18 +02:00
parent 7dfc94ad6e
commit 54a7a7e6ba
8 changed files with 58 additions and 62 deletions
+8 -8
View File
@@ -29,13 +29,13 @@ function Viewport(canvas) {
_rect.height += _borderWidth;
_rect.addTo(canvas).center().setCoords();
canvas.image
canvas.getImage()
.center()
.drag.enable(calcMinMaxBoundsForRect(_rect.getInsideBoundingRect(), canvas.image));
canvas.aperture.apply(_data.axis, _rect.getBoundingRect());
.drag.enable(calcMinMaxBoundsForRect(_rect.getInsideBoundingRect(), canvas.getImage()));
canvas.getApertures().apply(_data.axis, _rect.getBoundingRect());
drawBeams();
canvas.dragbars.apply();
canvas.getDragbars().apply();
// Apertures sometimes overlaps the viewports bounding rect.
// Solve this by bringing it to the front after apertures are applied.
@@ -115,13 +115,13 @@ function Viewport(canvas) {
* @return {Viewport}
*/
this.set = function (width, height) {
_data = util.calcCrop(canvas.image, width, height);
_data = util.calcCrop(canvas.getImage(), width, height);
apply();
this.gores.reset();
this.rulers.reset();
canvas.aperture.setTransparent(true);
canvas.image.__moved = false;
canvas.buttonMenu.bringToFront();
canvas.getApertures().setTransparent(true);
canvas.getImage().__moved = false;
canvas.getButtonMenu().bringToFront();
};
util.setProperties(this, {