Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
: _this.propsSize && _this.propsSize.height,
[38500] Fix | Delete
direction: 'right',
[38501] Fix | Delete
original: {
[38502] Fix | Delete
x: 0,
[38503] Fix | Delete
y: 0,
[38504] Fix | Delete
width: 0,
[38505] Fix | Delete
height: 0,
[38506] Fix | Delete
},
[38507] Fix | Delete
backgroundStyle: {
[38508] Fix | Delete
height: '100%',
[38509] Fix | Delete
width: '100%',
[38510] Fix | Delete
backgroundColor: 'rgba(0,0,0,0)',
[38511] Fix | Delete
cursor: 'auto',
[38512] Fix | Delete
opacity: 0,
[38513] Fix | Delete
position: 'fixed',
[38514] Fix | Delete
zIndex: 9999,
[38515] Fix | Delete
top: '0',
[38516] Fix | Delete
left: '0',
[38517] Fix | Delete
bottom: '0',
[38518] Fix | Delete
right: '0',
[38519] Fix | Delete
},
[38520] Fix | Delete
flexBasis: undefined,
[38521] Fix | Delete
};
[38522] Fix | Delete
_this.onResizeStart = _this.onResizeStart.bind(_this);
[38523] Fix | Delete
_this.onMouseMove = _this.onMouseMove.bind(_this);
[38524] Fix | Delete
_this.onMouseUp = _this.onMouseUp.bind(_this);
[38525] Fix | Delete
return _this;
[38526] Fix | Delete
}
[38527] Fix | Delete
Object.defineProperty(Resizable.prototype, "parentNode", {
[38528] Fix | Delete
get: function () {
[38529] Fix | Delete
if (!this.resizable) {
[38530] Fix | Delete
return null;
[38531] Fix | Delete
}
[38532] Fix | Delete
return this.resizable.parentNode;
[38533] Fix | Delete
},
[38534] Fix | Delete
enumerable: false,
[38535] Fix | Delete
configurable: true
[38536] Fix | Delete
});
[38537] Fix | Delete
Object.defineProperty(Resizable.prototype, "window", {
[38538] Fix | Delete
get: function () {
[38539] Fix | Delete
if (!this.resizable) {
[38540] Fix | Delete
return null;
[38541] Fix | Delete
}
[38542] Fix | Delete
if (!this.resizable.ownerDocument) {
[38543] Fix | Delete
return null;
[38544] Fix | Delete
}
[38545] Fix | Delete
return this.resizable.ownerDocument.defaultView;
[38546] Fix | Delete
},
[38547] Fix | Delete
enumerable: false,
[38548] Fix | Delete
configurable: true
[38549] Fix | Delete
});
[38550] Fix | Delete
Object.defineProperty(Resizable.prototype, "propsSize", {
[38551] Fix | Delete
get: function () {
[38552] Fix | Delete
return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
[38553] Fix | Delete
},
[38554] Fix | Delete
enumerable: false,
[38555] Fix | Delete
configurable: true
[38556] Fix | Delete
});
[38557] Fix | Delete
Object.defineProperty(Resizable.prototype, "size", {
[38558] Fix | Delete
get: function () {
[38559] Fix | Delete
var width = 0;
[38560] Fix | Delete
var height = 0;
[38561] Fix | Delete
if (this.resizable && this.window) {
[38562] Fix | Delete
var orgWidth = this.resizable.offsetWidth;
[38563] Fix | Delete
var orgHeight = this.resizable.offsetHeight;
[38564] Fix | Delete
// HACK: Set position `relative` to get parent size.
[38565] Fix | Delete
// This is because when re-resizable set `absolute`, I can not get base width correctly.
[38566] Fix | Delete
var orgPosition = this.resizable.style.position;
[38567] Fix | Delete
if (orgPosition !== 'relative') {
[38568] Fix | Delete
this.resizable.style.position = 'relative';
[38569] Fix | Delete
}
[38570] Fix | Delete
// INFO: Use original width or height if set auto.
[38571] Fix | Delete
width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth;
[38572] Fix | Delete
height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight;
[38573] Fix | Delete
// Restore original position
[38574] Fix | Delete
this.resizable.style.position = orgPosition;
[38575] Fix | Delete
}
[38576] Fix | Delete
return { width: width, height: height };
[38577] Fix | Delete
},
[38578] Fix | Delete
enumerable: false,
[38579] Fix | Delete
configurable: true
[38580] Fix | Delete
});
[38581] Fix | Delete
Object.defineProperty(Resizable.prototype, "sizeStyle", {
[38582] Fix | Delete
get: function () {
[38583] Fix | Delete
var _this = this;
[38584] Fix | Delete
var size = this.props.size;
[38585] Fix | Delete
var getSize = function (key) {
[38586] Fix | Delete
if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') {
[38587] Fix | Delete
return 'auto';
[38588] Fix | Delete
}
[38589] Fix | Delete
if (_this.propsSize && _this.propsSize[key] && endsWith(_this.propsSize[key].toString(), '%')) {
[38590] Fix | Delete
if (endsWith(_this.state[key].toString(), '%')) {
[38591] Fix | Delete
return _this.state[key].toString();
[38592] Fix | Delete
}
[38593] Fix | Delete
var parentSize = _this.getParentSize();
[38594] Fix | Delete
var value = Number(_this.state[key].toString().replace('px', ''));
[38595] Fix | Delete
var percent = (value / parentSize[key]) * 100;
[38596] Fix | Delete
return percent + "%";
[38597] Fix | Delete
}
[38598] Fix | Delete
return getStringSize(_this.state[key]);
[38599] Fix | Delete
};
[38600] Fix | Delete
var width = size && typeof size.width !== 'undefined' && !this.state.isResizing
[38601] Fix | Delete
? getStringSize(size.width)
[38602] Fix | Delete
: getSize('width');
[38603] Fix | Delete
var height = size && typeof size.height !== 'undefined' && !this.state.isResizing
[38604] Fix | Delete
? getStringSize(size.height)
[38605] Fix | Delete
: getSize('height');
[38606] Fix | Delete
return { width: width, height: height };
[38607] Fix | Delete
},
[38608] Fix | Delete
enumerable: false,
[38609] Fix | Delete
configurable: true
[38610] Fix | Delete
});
[38611] Fix | Delete
Resizable.prototype.getParentSize = function () {
[38612] Fix | Delete
if (!this.parentNode) {
[38613] Fix | Delete
if (!this.window) {
[38614] Fix | Delete
return { width: 0, height: 0 };
[38615] Fix | Delete
}
[38616] Fix | Delete
return { width: this.window.innerWidth, height: this.window.innerHeight };
[38617] Fix | Delete
}
[38618] Fix | Delete
var base = this.appendBase();
[38619] Fix | Delete
if (!base) {
[38620] Fix | Delete
return { width: 0, height: 0 };
[38621] Fix | Delete
}
[38622] Fix | Delete
// INFO: To calculate parent width with flex layout
[38623] Fix | Delete
var wrapChanged = false;
[38624] Fix | Delete
var wrap = this.parentNode.style.flexWrap;
[38625] Fix | Delete
if (wrap !== 'wrap') {
[38626] Fix | Delete
wrapChanged = true;
[38627] Fix | Delete
this.parentNode.style.flexWrap = 'wrap';
[38628] Fix | Delete
// HACK: Use relative to get parent padding size
[38629] Fix | Delete
}
[38630] Fix | Delete
base.style.position = 'relative';
[38631] Fix | Delete
base.style.minWidth = '100%';
[38632] Fix | Delete
var size = {
[38633] Fix | Delete
width: base.offsetWidth,
[38634] Fix | Delete
height: base.offsetHeight,
[38635] Fix | Delete
};
[38636] Fix | Delete
if (wrapChanged) {
[38637] Fix | Delete
this.parentNode.style.flexWrap = wrap;
[38638] Fix | Delete
}
[38639] Fix | Delete
this.removeBase(base);
[38640] Fix | Delete
return size;
[38641] Fix | Delete
};
[38642] Fix | Delete
Resizable.prototype.bindEvents = function () {
[38643] Fix | Delete
if (this.window) {
[38644] Fix | Delete
this.window.addEventListener('mouseup', this.onMouseUp);
[38645] Fix | Delete
this.window.addEventListener('mousemove', this.onMouseMove);
[38646] Fix | Delete
this.window.addEventListener('mouseleave', this.onMouseUp);
[38647] Fix | Delete
this.window.addEventListener('touchmove', this.onMouseMove, {
[38648] Fix | Delete
capture: true,
[38649] Fix | Delete
passive: false,
[38650] Fix | Delete
});
[38651] Fix | Delete
this.window.addEventListener('touchend', this.onMouseUp);
[38652] Fix | Delete
}
[38653] Fix | Delete
};
[38654] Fix | Delete
Resizable.prototype.unbindEvents = function () {
[38655] Fix | Delete
if (this.window) {
[38656] Fix | Delete
this.window.removeEventListener('mouseup', this.onMouseUp);
[38657] Fix | Delete
this.window.removeEventListener('mousemove', this.onMouseMove);
[38658] Fix | Delete
this.window.removeEventListener('mouseleave', this.onMouseUp);
[38659] Fix | Delete
this.window.removeEventListener('touchmove', this.onMouseMove, true);
[38660] Fix | Delete
this.window.removeEventListener('touchend', this.onMouseUp);
[38661] Fix | Delete
}
[38662] Fix | Delete
};
[38663] Fix | Delete
Resizable.prototype.componentDidMount = function () {
[38664] Fix | Delete
if (!this.resizable || !this.window) {
[38665] Fix | Delete
return;
[38666] Fix | Delete
}
[38667] Fix | Delete
var computedStyle = this.window.getComputedStyle(this.resizable);
[38668] Fix | Delete
this.setState({
[38669] Fix | Delete
width: this.state.width || this.size.width,
[38670] Fix | Delete
height: this.state.height || this.size.height,
[38671] Fix | Delete
flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined,
[38672] Fix | Delete
});
[38673] Fix | Delete
};
[38674] Fix | Delete
Resizable.prototype.componentWillUnmount = function () {
[38675] Fix | Delete
if (this.window) {
[38676] Fix | Delete
this.unbindEvents();
[38677] Fix | Delete
}
[38678] Fix | Delete
};
[38679] Fix | Delete
Resizable.prototype.createSizeForCssProperty = function (newSize, kind) {
[38680] Fix | Delete
var propsSize = this.propsSize && this.propsSize[kind];
[38681] Fix | Delete
return this.state[kind] === 'auto' &&
[38682] Fix | Delete
this.state.original[kind] === newSize &&
[38683] Fix | Delete
(typeof propsSize === 'undefined' || propsSize === 'auto')
[38684] Fix | Delete
? 'auto'
[38685] Fix | Delete
: newSize;
[38686] Fix | Delete
};
[38687] Fix | Delete
Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) {
[38688] Fix | Delete
var boundsByDirection = this.props.boundsByDirection;
[38689] Fix | Delete
var direction = this.state.direction;
[38690] Fix | Delete
var widthByDirection = boundsByDirection && hasDirection('left', direction);
[38691] Fix | Delete
var heightByDirection = boundsByDirection && hasDirection('top', direction);
[38692] Fix | Delete
var boundWidth;
[38693] Fix | Delete
var boundHeight;
[38694] Fix | Delete
if (this.props.bounds === 'parent') {
[38695] Fix | Delete
var parent_1 = this.parentNode;
[38696] Fix | Delete
if (parent_1) {
[38697] Fix | Delete
boundWidth = widthByDirection
[38698] Fix | Delete
? this.resizableRight - this.parentLeft
[38699] Fix | Delete
: parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
[38700] Fix | Delete
boundHeight = heightByDirection
[38701] Fix | Delete
? this.resizableBottom - this.parentTop
[38702] Fix | Delete
: parent_1.offsetHeight + (this.parentTop - this.resizableTop);
[38703] Fix | Delete
}
[38704] Fix | Delete
}
[38705] Fix | Delete
else if (this.props.bounds === 'window') {
[38706] Fix | Delete
if (this.window) {
[38707] Fix | Delete
boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
[38708] Fix | Delete
boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
[38709] Fix | Delete
}
[38710] Fix | Delete
}
[38711] Fix | Delete
else if (this.props.bounds) {
[38712] Fix | Delete
boundWidth = widthByDirection
[38713] Fix | Delete
? this.resizableRight - this.targetLeft
[38714] Fix | Delete
: this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
[38715] Fix | Delete
boundHeight = heightByDirection
[38716] Fix | Delete
? this.resizableBottom - this.targetTop
[38717] Fix | Delete
: this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
[38718] Fix | Delete
}
[38719] Fix | Delete
if (boundWidth && Number.isFinite(boundWidth)) {
[38720] Fix | Delete
maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
[38721] Fix | Delete
}
[38722] Fix | Delete
if (boundHeight && Number.isFinite(boundHeight)) {
[38723] Fix | Delete
maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
[38724] Fix | Delete
}
[38725] Fix | Delete
return { maxWidth: maxWidth, maxHeight: maxHeight };
[38726] Fix | Delete
};
[38727] Fix | Delete
Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) {
[38728] Fix | Delete
var scale = this.props.scale || 1;
[38729] Fix | Delete
var resizeRatio = this.props.resizeRatio || 1;
[38730] Fix | Delete
var _a = this.state, direction = _a.direction, original = _a.original;
[38731] Fix | Delete
var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
[38732] Fix | Delete
var newWidth = original.width;
[38733] Fix | Delete
var newHeight = original.height;
[38734] Fix | Delete
var extraHeight = lockAspectRatioExtraHeight || 0;
[38735] Fix | Delete
var extraWidth = lockAspectRatioExtraWidth || 0;
[38736] Fix | Delete
if (hasDirection('right', direction)) {
[38737] Fix | Delete
newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale;
[38738] Fix | Delete
if (lockAspectRatio) {
[38739] Fix | Delete
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
[38740] Fix | Delete
}
[38741] Fix | Delete
}
[38742] Fix | Delete
if (hasDirection('left', direction)) {
[38743] Fix | Delete
newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale;
[38744] Fix | Delete
if (lockAspectRatio) {
[38745] Fix | Delete
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
[38746] Fix | Delete
}
[38747] Fix | Delete
}
[38748] Fix | Delete
if (hasDirection('bottom', direction)) {
[38749] Fix | Delete
newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale;
[38750] Fix | Delete
if (lockAspectRatio) {
[38751] Fix | Delete
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
[38752] Fix | Delete
}
[38753] Fix | Delete
}
[38754] Fix | Delete
if (hasDirection('top', direction)) {
[38755] Fix | Delete
newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale;
[38756] Fix | Delete
if (lockAspectRatio) {
[38757] Fix | Delete
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
[38758] Fix | Delete
}
[38759] Fix | Delete
}
[38760] Fix | Delete
return { newWidth: newWidth, newHeight: newHeight };
[38761] Fix | Delete
};
[38762] Fix | Delete
Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) {
[38763] Fix | Delete
var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
[38764] Fix | Delete
var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width;
[38765] Fix | Delete
var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width;
[38766] Fix | Delete
var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height;
[38767] Fix | Delete
var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height;
[38768] Fix | Delete
var extraHeight = lockAspectRatioExtraHeight || 0;
[38769] Fix | Delete
var extraWidth = lockAspectRatioExtraWidth || 0;
[38770] Fix | Delete
if (lockAspectRatio) {
[38771] Fix | Delete
var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
[38772] Fix | Delete
var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
[38773] Fix | Delete
var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
[38774] Fix | Delete
var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
[38775] Fix | Delete
var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
[38776] Fix | Delete
var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
[38777] Fix | Delete
var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
[38778] Fix | Delete
var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
[38779] Fix | Delete
newWidth = clamp(newWidth, lockedMinWidth, lockedMaxWidth);
[38780] Fix | Delete
newHeight = clamp(newHeight, lockedMinHeight, lockedMaxHeight);
[38781] Fix | Delete
}
[38782] Fix | Delete
else {
[38783] Fix | Delete
newWidth = clamp(newWidth, computedMinWidth, computedMaxWidth);
[38784] Fix | Delete
newHeight = clamp(newHeight, computedMinHeight, computedMaxHeight);
[38785] Fix | Delete
}
[38786] Fix | Delete
return { newWidth: newWidth, newHeight: newHeight };
[38787] Fix | Delete
};
[38788] Fix | Delete
Resizable.prototype.setBoundingClientRect = function () {
[38789] Fix | Delete
// For parent boundary
[38790] Fix | Delete
if (this.props.bounds === 'parent') {
[38791] Fix | Delete
var parent_2 = this.parentNode;
[38792] Fix | Delete
if (parent_2) {
[38793] Fix | Delete
var parentRect = parent_2.getBoundingClientRect();
[38794] Fix | Delete
this.parentLeft = parentRect.left;
[38795] Fix | Delete
this.parentTop = parentRect.top;
[38796] Fix | Delete
}
[38797] Fix | Delete
}
[38798] Fix | Delete
// For target(html element) boundary
[38799] Fix | Delete
if (this.props.bounds && typeof this.props.bounds !== 'string') {
[38800] Fix | Delete
var targetRect = this.props.bounds.getBoundingClientRect();
[38801] Fix | Delete
this.targetLeft = targetRect.left;
[38802] Fix | Delete
this.targetTop = targetRect.top;
[38803] Fix | Delete
}
[38804] Fix | Delete
// For boundary
[38805] Fix | Delete
if (this.resizable) {
[38806] Fix | Delete
var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
[38807] Fix | Delete
this.resizableLeft = left;
[38808] Fix | Delete
this.resizableRight = right;
[38809] Fix | Delete
this.resizableTop = top_1;
[38810] Fix | Delete
this.resizableBottom = bottom;
[38811] Fix | Delete
}
[38812] Fix | Delete
};
[38813] Fix | Delete
Resizable.prototype.onResizeStart = function (event, direction) {
[38814] Fix | Delete
if (!this.resizable || !this.window) {
[38815] Fix | Delete
return;
[38816] Fix | Delete
}
[38817] Fix | Delete
var clientX = 0;
[38818] Fix | Delete
var clientY = 0;
[38819] Fix | Delete
if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
[38820] Fix | Delete
clientX = event.nativeEvent.clientX;
[38821] Fix | Delete
clientY = event.nativeEvent.clientY;
[38822] Fix | Delete
// When user click with right button the resize is stuck in resizing mode
[38823] Fix | Delete
// until users clicks again, dont continue if right click is used.
[38824] Fix | Delete
// HACK: MouseEvent does not have `which` from flow-bin v0.68.
[38825] Fix | Delete
if (event.nativeEvent.which === 3) {
[38826] Fix | Delete
return;
[38827] Fix | Delete
}
[38828] Fix | Delete
}
[38829] Fix | Delete
else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) {
[38830] Fix | Delete
clientX = event.nativeEvent.touches[0].clientX;
[38831] Fix | Delete
clientY = event.nativeEvent.touches[0].clientY;
[38832] Fix | Delete
}
[38833] Fix | Delete
if (this.props.onResizeStart) {
[38834] Fix | Delete
if (this.resizable) {
[38835] Fix | Delete
var startResize = this.props.onResizeStart(event, direction, this.resizable);
[38836] Fix | Delete
if (startResize === false) {
[38837] Fix | Delete
return;
[38838] Fix | Delete
}
[38839] Fix | Delete
}
[38840] Fix | Delete
}
[38841] Fix | Delete
// Fix #168
[38842] Fix | Delete
if (this.props.size) {
[38843] Fix | Delete
if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
[38844] Fix | Delete
this.setState({ height: this.props.size.height });
[38845] Fix | Delete
}
[38846] Fix | Delete
if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
[38847] Fix | Delete
this.setState({ width: this.props.size.width });
[38848] Fix | Delete
}
[38849] Fix | Delete
}
[38850] Fix | Delete
// For lockAspectRatio case
[38851] Fix | Delete
this.ratio =
[38852] Fix | Delete
typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height;
[38853] Fix | Delete
var flexBasis;
[38854] Fix | Delete
var computedStyle = this.window.getComputedStyle(this.resizable);
[38855] Fix | Delete
if (computedStyle.flexBasis !== 'auto') {
[38856] Fix | Delete
var parent_3 = this.parentNode;
[38857] Fix | Delete
if (parent_3) {
[38858] Fix | Delete
var dir = this.window.getComputedStyle(parent_3).flexDirection;
[38859] Fix | Delete
this.flexDir = dir.startsWith('row') ? 'row' : 'column';
[38860] Fix | Delete
flexBasis = computedStyle.flexBasis;
[38861] Fix | Delete
}
[38862] Fix | Delete
}
[38863] Fix | Delete
// For boundary
[38864] Fix | Delete
this.setBoundingClientRect();
[38865] Fix | Delete
this.bindEvents();
[38866] Fix | Delete
var state = {
[38867] Fix | Delete
original: {
[38868] Fix | Delete
x: clientX,
[38869] Fix | Delete
y: clientY,
[38870] Fix | Delete
width: this.size.width,
[38871] Fix | Delete
height: this.size.height,
[38872] Fix | Delete
},
[38873] Fix | Delete
isResizing: true,
[38874] Fix | Delete
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }),
[38875] Fix | Delete
direction: direction,
[38876] Fix | Delete
flexBasis: flexBasis,
[38877] Fix | Delete
};
[38878] Fix | Delete
this.setState(state);
[38879] Fix | Delete
};
[38880] Fix | Delete
Resizable.prototype.onMouseMove = function (event) {
[38881] Fix | Delete
if (!this.state.isResizing || !this.resizable || !this.window) {
[38882] Fix | Delete
return;
[38883] Fix | Delete
}
[38884] Fix | Delete
if (this.window.TouchEvent && isTouchEvent(event)) {
[38885] Fix | Delete
try {
[38886] Fix | Delete
event.preventDefault();
[38887] Fix | Delete
event.stopPropagation();
[38888] Fix | Delete
}
[38889] Fix | Delete
catch (e) {
[38890] Fix | Delete
// Ignore on fail
[38891] Fix | Delete
}
[38892] Fix | Delete
}
[38893] Fix | Delete
var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
[38894] Fix | Delete
var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX;
[38895] Fix | Delete
var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY;
[38896] Fix | Delete
var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
[38897] Fix | Delete
var parentSize = this.getParentSize();
[38898] Fix | Delete
var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
[38899] Fix | Delete
maxWidth = max.maxWidth;
[38900] Fix | Delete
maxHeight = max.maxHeight;
[38901] Fix | Delete
minWidth = max.minWidth;
[38902] Fix | Delete
minHeight = max.minHeight;
[38903] Fix | Delete
// Calculate new size
[38904] Fix | Delete
var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
[38905] Fix | Delete
// Calculate max size from boundary settings
[38906] Fix | Delete
var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
[38907] Fix | Delete
// Calculate new size from aspect ratio
[38908] Fix | Delete
var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
[38909] Fix | Delete
newWidth = newSize.newWidth;
[38910] Fix | Delete
newHeight = newSize.newHeight;
[38911] Fix | Delete
if (this.props.grid) {
[38912] Fix | Delete
var newGridWidth = snap(newWidth, this.props.grid[0]);
[38913] Fix | Delete
var newGridHeight = snap(newHeight, this.props.grid[1]);
[38914] Fix | Delete
var gap = this.props.snapGap || 0;
[38915] Fix | Delete
newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
[38916] Fix | Delete
newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
[38917] Fix | Delete
}
[38918] Fix | Delete
if (this.props.snap && this.props.snap.x) {
[38919] Fix | Delete
newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
[38920] Fix | Delete
}
[38921] Fix | Delete
if (this.props.snap && this.props.snap.y) {
[38922] Fix | Delete
newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
[38923] Fix | Delete
}
[38924] Fix | Delete
var delta = {
[38925] Fix | Delete
width: newWidth - original.width,
[38926] Fix | Delete
height: newHeight - original.height,
[38927] Fix | Delete
};
[38928] Fix | Delete
if (width && typeof width === 'string') {
[38929] Fix | Delete
if (endsWith(width, '%')) {
[38930] Fix | Delete
var percent = (newWidth / parentSize.width) * 100;
[38931] Fix | Delete
newWidth = percent + "%";
[38932] Fix | Delete
}
[38933] Fix | Delete
else if (endsWith(width, 'vw')) {
[38934] Fix | Delete
var vw = (newWidth / this.window.innerWidth) * 100;
[38935] Fix | Delete
newWidth = vw + "vw";
[38936] Fix | Delete
}
[38937] Fix | Delete
else if (endsWith(width, 'vh')) {
[38938] Fix | Delete
var vh = (newWidth / this.window.innerHeight) * 100;
[38939] Fix | Delete
newWidth = vh + "vh";
[38940] Fix | Delete
}
[38941] Fix | Delete
}
[38942] Fix | Delete
if (height && typeof height === 'string') {
[38943] Fix | Delete
if (endsWith(height, '%')) {
[38944] Fix | Delete
var percent = (newHeight / parentSize.height) * 100;
[38945] Fix | Delete
newHeight = percent + "%";
[38946] Fix | Delete
}
[38947] Fix | Delete
else if (endsWith(height, 'vw')) {
[38948] Fix | Delete
var vw = (newHeight / this.window.innerWidth) * 100;
[38949] Fix | Delete
newHeight = vw + "vw";
[38950] Fix | Delete
}
[38951] Fix | Delete
else if (endsWith(height, 'vh')) {
[38952] Fix | Delete
var vh = (newHeight / this.window.innerHeight) * 100;
[38953] Fix | Delete
newHeight = vh + "vh";
[38954] Fix | Delete
}
[38955] Fix | Delete
}
[38956] Fix | Delete
var newState = {
[38957] Fix | Delete
width: this.createSizeForCssProperty(newWidth, 'width'),
[38958] Fix | Delete
height: this.createSizeForCssProperty(newHeight, 'height'),
[38959] Fix | Delete
};
[38960] Fix | Delete
if (this.flexDir === 'row') {
[38961] Fix | Delete
newState.flexBasis = newState.width;
[38962] Fix | Delete
}
[38963] Fix | Delete
else if (this.flexDir === 'column') {
[38964] Fix | Delete
newState.flexBasis = newState.height;
[38965] Fix | Delete
}
[38966] Fix | Delete
this.setState(newState);
[38967] Fix | Delete
if (this.props.onResize) {
[38968] Fix | Delete
this.props.onResize(event, direction, this.resizable, delta);
[38969] Fix | Delete
}
[38970] Fix | Delete
};
[38971] Fix | Delete
Resizable.prototype.onMouseUp = function (event) {
[38972] Fix | Delete
var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
[38973] Fix | Delete
if (!isResizing || !this.resizable) {
[38974] Fix | Delete
return;
[38975] Fix | Delete
}
[38976] Fix | Delete
var delta = {
[38977] Fix | Delete
width: this.size.width - original.width,
[38978] Fix | Delete
height: this.size.height - original.height,
[38979] Fix | Delete
};
[38980] Fix | Delete
if (this.props.onResizeStop) {
[38981] Fix | Delete
this.props.onResizeStop(event, direction, this.resizable, delta);
[38982] Fix | Delete
}
[38983] Fix | Delete
if (this.props.size) {
[38984] Fix | Delete
this.setState(this.props.size);
[38985] Fix | Delete
}
[38986] Fix | Delete
this.unbindEvents();
[38987] Fix | Delete
this.setState({
[38988] Fix | Delete
isResizing: false,
[38989] Fix | Delete
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }),
[38990] Fix | Delete
});
[38991] Fix | Delete
};
[38992] Fix | Delete
Resizable.prototype.updateSize = function (size) {
[38993] Fix | Delete
this.setState({ width: size.width, height: size.height });
[38994] Fix | Delete
};
[38995] Fix | Delete
Resizable.prototype.renderResizer = function () {
[38996] Fix | Delete
var _this = this;
[38997] Fix | Delete
var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
[38998] Fix | Delete
if (!enable) {
[38999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function