Refactor properties into methods for viewport
This commit is contained in:
@@ -117,32 +117,25 @@ function Viewport(canvas) {
|
||||
this.set = function (width, height) {
|
||||
_data = util.calcCrop(canvas.getImage(), width, height);
|
||||
apply();
|
||||
this.gores.reset();
|
||||
this.rulers.reset();
|
||||
this.getGores().reset();
|
||||
this.getRulers().reset();
|
||||
canvas.getApertures().setTransparent(true);
|
||||
canvas.getImage().__moved = false;
|
||||
canvas.getButtonMenu().bringToFront();
|
||||
};
|
||||
|
||||
util.setProperties(this, {
|
||||
data: {
|
||||
get: function () {
|
||||
return _data;
|
||||
}
|
||||
},
|
||||
gores: {
|
||||
get: function () {
|
||||
return this.__goreHandler ||
|
||||
(this.__goreHandler = new GoreHandler(this));
|
||||
}
|
||||
},
|
||||
rulers: {
|
||||
get: function () {
|
||||
return this.__rulerHandler ||
|
||||
(this.__rulerHandler = new RulerHandler(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
this.getCropData = function () {
|
||||
return _data;
|
||||
};
|
||||
|
||||
this.getGores = function () {
|
||||
return this.__goreHandler || (this.__goreHandler = new GoreHandler(this));
|
||||
};
|
||||
|
||||
this.getRulers = function () {
|
||||
return this.__rulerHandler || (this.__rulerHandler = new RulerHandler(this));
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
module.exports = Viewport;
|
||||
|
||||
Reference in New Issue
Block a user