Remove jquery from MinimapController.js

This commit is contained in:
Julian Descottes 2018-04-08 16:29:38 +02:00
parent 7b8978da7a
commit 34a88b79a0

View File

@ -5,7 +5,7 @@
this.piskelController = piskelController;
this.previewController = previewController;
this.drawingController = drawingController;
this.container = container;
this.container = container.get(0);
this.isClicked = false;
this.isVisible = false;
@ -16,14 +16,14 @@
this.minimapEl = document.createElement('DIV');
this.minimapEl.className = 'minimap-crop-frame';
this.minimapEl.style.display = 'none';
$(this.container).append(this.minimapEl);
this.container.appendChild(this.minimapEl);
// Init mouse events
$(this.container).mousedown(this.onMinimapMousedown_.bind(this));
$('body').mousemove(this.onMinimapMousemove_.bind(this));
$('body').mouseup(this.onMinimapMouseup_.bind(this));
this.container.addEventListener('mousedown', this.onMinimapMousedown_.bind(this));
document.body.addEventListener('mousemove', this.onMinimapMousemove_.bind(this));
document.body.addEventListener('mouseup', this.onMinimapMouseup_.bind(this));
$.subscribe(Events.ZOOM_CHANGED, $.proxy(this.renderMinimap_, this));
$.subscribe(Events.ZOOM_CHANGED, this.renderMinimap_.bind(this));
};
ns.MinimapController.prototype.renderMinimap_ = function () {
@ -40,8 +40,9 @@
var minimapSize = this.getMinimapSize_();
var previewSize = this.getPreviewSize_();
var containerHeight = this.container.height();
var containerWidth = this.container.width();
var containerRect = this.container.getBoundingClientRect();
var containerHeight = containerRect.height;
var containerWidth = containerRect.width;
// offset(x, y) in frame pixels
var offset = this.drawingController.getRenderer().getOffset();