Browse Source

Use `mousePosFetcher` also on `start` in Resizer. Closes #4580

pull/4591/head
Artur Arseniev 4 years ago
parent
commit
7701801f76
  1. 21
      src/utils/Resizer.js

21
src/utils/Resizer.js

@ -258,9 +258,10 @@ class Resizer {
const parentEl = this.getParentEl(); const parentEl = this.getParentEl();
const resizer = this; const resizer = this;
const config = this.opts || {}; const config = this.opts || {};
var attrName = 'data-' + config.prefix + 'handler'; const mouseFetch = this.mousePosFetcher;
var rect = this.getElementPos(el, { target: 'el' }); const attrName = 'data-' + config.prefix + 'handler';
var parentRect = this.getElementPos(parentEl); const rect = this.getElementPos(el, { target: 'el' });
const parentRect = this.getElementPos(parentEl);
this.handlerAttr = e.target.getAttribute(attrName); this.handlerAttr = e.target.getAttribute(attrName);
this.clickedHandler = e.target; this.clickedHandler = e.target;
this.startDim = { this.startDim = {
@ -275,10 +276,12 @@ class Resizer {
w: rect.width, w: rect.width,
h: rect.height, h: rect.height,
}; };
this.startPos = { this.startPos = mouseFetch
x: e.clientX, ? mouseFetch(e)
y: e.clientY, : {
}; x: e.clientX,
y: e.clientY,
};
this.parentDim = { this.parentDim = {
t: parentRect.top, t: parentRect.top,
l: parentRect.left, l: parentRect.left,
@ -303,8 +306,8 @@ class Resizer {
*/ */
move(e) { move(e) {
const onMove = this.onMove; const onMove = this.onMove;
var mouseFetch = this.mousePosFetcher; const mouseFetch = this.mousePosFetcher;
var currentPos = mouseFetch const currentPos = mouseFetch
? mouseFetch(e) ? mouseFetch(e)
: { : {
x: e.clientX, x: e.clientX,

Loading…
Cancel
Save