Skip to content

Commit 2d4124f

Browse files
committed
fix dialog clear bug, do not work when dialog in corners
1 parent 80cc0cc commit 2d4124f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dialog_clear.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ export function dialogClear(doc: Document, bgLayer: ArtLayer, overLayer: ArtLaye
4848
{ x: width - 1, y: height -1 },
4949
];
5050
for (let j = 0; j < corners.length; j++) {
51-
if (getColor(doc, UnitValue(corners[j].x, 'px'), UnitValue(corners[j].y, 'px')) == tmp_color) {
51+
let x = corners[j].x;
52+
let y = corners[j].y;
53+
let color = getColor(doc, UnitValue(x, 'px'), UnitValue(y, 'px'));
54+
if (color.rgb.hexValue == tmp_color.rgb.hexValue) {
55+
log("detect corner (" + x + "," + y + ") is tmp_color");
5256
continue;
5357
}
54-
MyAction.magicWand(corners[j].x, corners[j].y, 0, false, true, 'addTo');
58+
MyAction.magicWand(x, y, 0, false, true, 'addTo');
5559
}
5660
doc.selection.invert();
5761
doc.selection.contract(contract);

0 commit comments

Comments
 (0)