canvas-editor-engine 1.1.43 → 1.1.45
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.
|
@@ -11,22 +11,19 @@ class ProjectFileSerializer {
|
|
|
11
11
|
;
|
|
12
12
|
load() {
|
|
13
13
|
const rowProjects = JSON.parse(this.file);
|
|
14
|
-
const imageDataProcessor = (
|
|
15
|
-
const data =
|
|
14
|
+
const imageDataProcessor = (state) => {
|
|
15
|
+
const data = state.imageData.data;
|
|
16
16
|
// const tempCanvas = document.createElement('canvas');
|
|
17
17
|
// const tempCtx = tempCanvas.getContext('2d');
|
|
18
18
|
// const tempImageData = tempCtx.getImageData(0, 0, _imageData.width, _imageData.height);
|
|
19
|
-
const tempImageData = new ImageData(
|
|
19
|
+
const tempImageData = new ImageData(state.size.width, state.size.height);
|
|
20
20
|
data.forEach((colorAtom, index) => {
|
|
21
21
|
tempImageData.data[index] = colorAtom;
|
|
22
22
|
});
|
|
23
23
|
return tempImageData;
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// console.log('test', test);
|
|
28
|
-
console.log(rowProjects[0].state.current.imageData.height, rowProjects[0].state.current.imageData.width);
|
|
29
|
-
console.log(rowProjects[0].state.current);
|
|
25
|
+
const test = imageDataProcessor(rowProjects[0].state.current);
|
|
26
|
+
console.log('test', test);
|
|
30
27
|
// const projects = rowProjects.map((project) => {
|
|
31
28
|
// project.state.current.imageData = imageDataProcessor(project.state.current.imageData);
|
|
32
29
|
// project.state.history = project.state.history.map((historyLine) => {
|