piskel/js/rendering/RendererManager.js
jdescottes 51f86afe6e feature : zoom
- Created AbstractRenderer in rendering package
- Created CachedRenderer and CachedFrameRenderer to extract basic frame
  caching logic from DrawingController
- Created RendererManager to synchronize updates made to several Renderer
  settings
- Moved FrameRenderer from pskl.rendering to pskl.rendering.frame
- Fixed the resize of the drawing area when the window is resized
2013-11-01 15:39:42 +01:00

30 lines
No EOL
747 B
JavaScript

(function () {
var ns = $.namespace('pskl.rendering');
ns.RendererManager = function () {
this.renderers = [];
};
ns.RendererManager.prototype.add = function (renderer) {
this.renderers.push(renderer);
return this;
};
ns.RendererManager.prototype.setZoom = function (zoom) {
this.renderers.forEach(function (renderer) {
renderer.setZoom(zoom);
});
};
ns.RendererManager.prototype.setDisplaySize = function (w, h) {
this.renderers.forEach(function (renderer) {
renderer.setDisplaySize(w, h);
});
};
ns.RendererManager.prototype.moveOffset = function (offsetX, offsetY) {
this.renderers.forEach(function (renderer) {
renderer.moveOffset(offsetX, offsetY);
});
};
})();