@yorab/react-paint 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,7 +19,7 @@ var _canvas = require("../canvas");
|
|
|
19
19
|
|
|
20
20
|
var _rectangle = require("./rectangle");
|
|
21
21
|
|
|
22
|
-
const createPictureShape = (img, maxPictureWidth, maxPictureHeight) => {
|
|
22
|
+
const createPictureShape = (img, storedSrc, maxPictureWidth, maxPictureHeight) => {
|
|
23
23
|
const [width, height] = (0, _transform.fitContentInsideContainer)(img.width, img.height, maxPictureWidth, maxPictureHeight, true);
|
|
24
24
|
return {
|
|
25
25
|
toolId: _tools.DEFAULT_SHAPE_PICTURE.id,
|
|
@@ -29,7 +29,7 @@ const createPictureShape = (img, maxPictureWidth, maxPictureHeight) => {
|
|
|
29
29
|
y: (maxPictureHeight - height) / 2,
|
|
30
30
|
width,
|
|
31
31
|
height,
|
|
32
|
-
src:
|
|
32
|
+
src: storedSrc,
|
|
33
33
|
img,
|
|
34
34
|
rotation: 0
|
|
35
35
|
};
|
|
@@ -46,7 +46,7 @@ const createFilePicture = (img, resolve, file, maxPictureWidth, maxPictureHeight
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const pictureShape = createPictureShape(img, maxPictureWidth, maxPictureHeight);
|
|
49
|
+
const pictureShape = createPictureShape(img, img.src, maxPictureWidth, maxPictureHeight);
|
|
50
50
|
resolve(pictureShape);
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ const createFilePicture = (img, resolve, file, maxPictureWidth, maxPictureHeight
|
|
|
55
55
|
|
|
56
56
|
const createUrlPicture = (img, resolve, url, maxPictureWidth, maxPictureHeight) => {
|
|
57
57
|
img.onload = () => {
|
|
58
|
-
const pictureShape = createPictureShape(img, maxPictureWidth, maxPictureHeight);
|
|
58
|
+
const pictureShape = createPictureShape(img, url, maxPictureWidth, maxPictureHeight);
|
|
59
59
|
resolve(pictureShape);
|
|
60
60
|
};
|
|
61
61
|
|