canvas-editor-engine 1.1.8 → 1.1.9

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.
@@ -32,40 +32,42 @@ class Filter {
32
32
  height: imageData.height,
33
33
  };
34
34
  ;
35
- // case 1: Xcanvas -> Ximage
35
+ // case 1: Xcanvas -> Ximage && case 3: Ycanvas -> Yimage
36
36
  let leftIndex;
37
+ let upIndex;
37
38
  for (const [iy, row] of RGBAMatrix.entries()) {
38
39
  for (const [ix, rowItem] of row.entries()) {
39
40
  const isNotEmpty = rowItem[3 /* E_RGBA.a */] !== 0;
40
41
  if (isNotEmpty) {
41
42
  leftIndex = ix;
43
+ upIndex = iy;
42
44
  break;
43
45
  }
44
46
  }
45
- if (leftIndex !== undefined) {
47
+ if (leftIndex !== undefined && upIndex !== undefined) {
46
48
  break;
47
49
  }
48
50
  }
49
51
  console.log('case 1: Xcanvas -> Ximage; leftIndex:', leftIndex);
50
- // case 2: Ximage <- Xcanvas
52
+ console.log('case 3: Ycanvas -> Yimage; upIndex:', upIndex);
53
+ // case 2: Ximage <- Xcanvas && case 4: Yimage <- Ycanvas
51
54
  let rightIndex;
52
- for (const [iy, row] of RGBAMatrix.entries()) {
55
+ let downIndex;
56
+ for (const [iy, row] of RGBAMatrix.reverse().entries()) {
53
57
  for (const [ix, rowItem] of row.reverse().entries()) {
54
58
  const isNotEmpty = rowItem[3 /* E_RGBA.a */] !== 0;
55
59
  if (isNotEmpty) {
56
60
  rightIndex = ix;
61
+ downIndex = iy;
57
62
  break;
58
63
  }
59
64
  }
60
- if (rightIndex !== undefined) {
65
+ if (rightIndex !== undefined && downIndex !== undefined) {
61
66
  break;
62
67
  }
63
68
  }
64
69
  console.log('case 2: Ximage <- Xcanvas; rightIndex:', rightIndex);
65
- // case 3: Ycanvas -> Yimage
66
- let upIndex;
67
- // case 4: Yimage <- Ycanvas
68
- let downIndex;
70
+ console.log('case 4: Yimage <- Ycanvas; downIndex:', downIndex);
69
71
  // const cleared = rowRGBABuff.filter((byteArray) => {
70
72
  // const alpha = byteArray[E_RGBA.a];
71
73
  // return !!alpha;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",