filerobot-image-editor
Advanced tools
Comparing version 3.12.3-beta.4 to 3.12.3-beta.5
@@ -95,7 +95,7 @@ "use strict"; | ||
_defineProperty(_assertThisInitialized(_this), "prepareFinalCanvas", function () { | ||
var _this$state$latestCan = _this.state.latestCanvasSize, | ||
width = _this$state$latestCan.width, | ||
height = _this$state$latestCan.height; | ||
var shapes = _this.props.shapes; | ||
var newCanvas = document.createElement('canvas'); | ||
var _this$state$originalC = _this.state.originalCanvasDimensions, | ||
width = _this$state$originalC.width, | ||
height = _this$state$originalC.height; | ||
newCanvas.width = width; | ||
@@ -1005,12 +1005,17 @@ newCanvas.height = height; | ||
if (width > _this._canvas.width) { | ||
width = width / (width / _this._canvas.width); | ||
if (height > _this._canvas.height) { | ||
var ratio = height / _this._canvas.height; | ||
height /= ratio; | ||
width /= ratio; | ||
} | ||
if (height > _this._canvas.height) { | ||
height = height / (height / _this._canvas.height); | ||
if (width > _this._canvas.width) { | ||
var _ratio = width / _this._canvas.width; | ||
height /= _ratio; | ||
width /= _ratio; | ||
} | ||
width = _this.fromoriginalCanvasDimensionsValue(width, 'width'); | ||
height = _this.fromoriginalCanvasDimensionsValue(height, 'height'); | ||
width = _this.fromLatestCanvasSizeValue(width, 'width'); | ||
height = _this.fromLatestCanvasSizeValue(height, 'height'); | ||
return [width, height]; | ||
@@ -1374,6 +1379,6 @@ }); | ||
_defineProperty(_assertThisInitialized(_this), "fromoriginalCanvasDimensionsValue", function (number, property) { | ||
if (_this._canvas && _this.state.originalCanvasDimensions) { | ||
// property = width/height | ||
return number.mapNumber(0, _this.state.originalCanvasDimensions[property], 0, _this._canvas[property]); | ||
_defineProperty(_assertThisInitialized(_this), "fromLatestCanvasSizeValue", function (number, property) { | ||
if (_this._canvas && _this.state.latestCanvasSize) { | ||
// property = width or height | ||
return number.mapNumber(0, _this.state.latestCanvasSize[property], 0, _this._canvas[property]); | ||
} | ||
@@ -1388,3 +1393,3 @@ | ||
resizeControlTarget: null, | ||
originalCanvasDimensions: null | ||
latestCanvasSize: null | ||
}; | ||
@@ -1533,3 +1538,6 @@ return _this; | ||
return _objectSpread(_objectSpread({}, state), {}, { | ||
originalCanvasDimensions: props.originalCanvasDimensions | ||
latestCanvasSize: props.latestCanvasSize || { | ||
width: 0, | ||
height: 0 | ||
} | ||
}); | ||
@@ -1536,0 +1544,0 @@ } |
@@ -77,3 +77,3 @@ "use strict"; | ||
roundCrop = _this$props.roundCrop, | ||
canvasDimensions = _this$props.canvasDimensions; | ||
latestCanvasSize = _this$props.latestCanvasSize; | ||
var applyByDefault = watermark.applyByDefault; | ||
@@ -94,3 +94,3 @@ var canvas = (0, _utils.getCanvasNode)(editorWrapperId); | ||
round: roundCrop, | ||
originalCanvasDimensions: canvasDimensions, | ||
latestCanvasSize: latestCanvasSize, | ||
colorScheme: colorScheme, | ||
@@ -97,0 +97,0 @@ wrapperId: editorWrapperId |
@@ -74,2 +74,4 @@ "use strict"; | ||
function _default(props) { | ||
var _urls, _urls$; | ||
var _this; | ||
@@ -385,3 +387,3 @@ | ||
_this.initWatermarkImage(_url); | ||
_this.initWatermarkImage(_url || ((_urls = urls) === null || _urls === void 0 ? void 0 : (_urls$ = _urls[0]) === null || _urls$ === void 0 ? void 0 : _urls$.url)); | ||
@@ -388,0 +390,0 @@ _this.state = { |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -113,3 +115,3 @@ | ||
logoImage.setAttribute('crossOrigin', 'Anonymous'); | ||
logoImage.src = watermark.url + '?' + new Date().getTime(); | ||
logoImage.src = watermark.url + (watermark.url.indexOf('?') > -1 ? '&' : '?') + new Date().getTime(); | ||
} | ||
@@ -216,5 +218,7 @@ | ||
_this.setState({ | ||
imageMime: (0, _imageType.default)(new Uint8Array(target.response)).mime | ||
}); | ||
if (target && target.response) { | ||
_this.setState({ | ||
imageMime: (0, _imageType.default)(new Uint8Array(target.response)).mime | ||
}); | ||
} | ||
}; | ||
@@ -229,2 +233,9 @@ | ||
if (_this._isMounted) { | ||
var editorWrapperId = _this.props.config.elementId; | ||
var canvas = (0, _utils.getCanvasNode)(editorWrapperId, _this.props.initialZoom !== 1 ? _config.ORIGINAL_CANVAS_ID : _config.CANVAS_ID); | ||
props.latestCanvasSize = { | ||
width: canvas.width, | ||
height: canvas.height | ||
}; | ||
_this.setState(props, callback); | ||
@@ -579,3 +590,4 @@ } | ||
selectedShape = _this$state8.selectedShape, | ||
availableShapes = _this$state8.availableShapes; | ||
availableShapes = _this$state8.availableShapes, | ||
latestCanvasSize = _this$state8.latestCanvasSize; | ||
var _this$props = this.props, | ||
@@ -692,3 +704,4 @@ src = _this$props.src, | ||
shapeOperations: shapeOperations, | ||
selectedShape: selectedShape | ||
selectedShape: selectedShape, | ||
latestCanvasSize: latestCanvasSize | ||
}); | ||
@@ -695,0 +708,0 @@ |
{ | ||
"name": "filerobot-image-editor", | ||
"version": "3.12.3-beta.4", | ||
"version": "3.12.3-beta.5", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Edit, resize, and filter any image!", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
776443
15397