Remove jquery from FrameRenderer.js

This commit is contained in:
Julian Descottes 2018-04-08 13:22:41 +02:00
parent 027cd2e2a6
commit f69e502639
2 changed files with 12 additions and 11 deletions

View file

@ -29,10 +29,11 @@
'yOffset' : 0 'yOffset' : 0
}; };
this.overlayRenderer = new pskl.rendering.frame.CachedFrameRenderer(this.container, cfg, ['canvas-overlay']); var containerEl = this.container.get(0);
this.renderer = new pskl.rendering.frame.CachedFrameRenderer(this.container, cfg, ['drawing-canvas']); this.overlayRenderer = new pskl.rendering.frame.CachedFrameRenderer(containerEl, cfg, ['canvas-overlay']);
this.onionSkinRenderer = pskl.rendering.OnionSkinRenderer.createInContainer(this.container, cfg, piskelController); this.renderer = new pskl.rendering.frame.CachedFrameRenderer(containerEl, cfg, ['drawing-canvas']);
this.layersRenderer = new pskl.rendering.layer.LayersRenderer(this.container, cfg, piskelController); this.onionSkinRenderer = pskl.rendering.OnionSkinRenderer.createInContainer(containerEl, cfg, piskelController);
this.layersRenderer = new pskl.rendering.layer.LayersRenderer(containerEl, cfg, piskelController);
this.compositeRenderer = new pskl.rendering.CompositeRenderer(); this.compositeRenderer = new pskl.rendering.CompositeRenderer();
this.compositeRenderer this.compositeRenderer

View file

@ -199,7 +199,7 @@
this.displayCanvas = pskl.utils.CanvasUtils.createCanvas(width, height, this.classList); this.displayCanvas = pskl.utils.CanvasUtils.createCanvas(width, height, this.classList);
pskl.utils.CanvasUtils.disableImageSmoothing(this.displayCanvas); pskl.utils.CanvasUtils.disableImageSmoothing(this.displayCanvas);
this.container.append(this.displayCanvas); this.container.appendChild(this.displayCanvas);
}; };
ns.FrameRenderer.prototype.onUserSettingsChange_ = function (evt, settingName, settingValue) { ns.FrameRenderer.prototype.onUserSettingsChange_ = function (evt, settingName, settingValue) {
@ -230,9 +230,9 @@
* @public * @public
*/ */
ns.FrameRenderer.prototype.getCoordinates = function(x, y) { ns.FrameRenderer.prototype.getCoordinates = function(x, y) {
var containerOffset = this.container.offset(); var containerRect = this.container.getBoundingClientRect();
x = x - containerOffset.left; x = x - containerRect.left;
y = y - containerOffset.top; y = y - containerRect.top;
// apply margins // apply margins
x = x - this.margin.x; x = x - this.margin.x;
@ -261,9 +261,9 @@
x = x + this.margin.x; x = x + this.margin.x;
y = y + this.margin.y; y = y + this.margin.y;
var containerOffset = this.container.offset(); var containerRect = this.container.getBoundingClientRect();
x = x + containerOffset.left; x = x + containerRect.left;
y = y + containerOffset.top; y = y + containerRect.top;
return { return {
x : x + (cellSize / 2), x : x + (cellSize / 2),