Skip to content

Commit

Permalink
♻️ colorCode を明示
Browse files Browse the repository at this point in the history
  • Loading branch information
SSlime-s committed May 20, 2024
1 parent 12a42aa commit 79f2108
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/client/app/features/artboard/bucketFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function bucketFill(
canvas: HTMLCanvasElement,
x: number,
y: number,
color: `#${string}`,
colorCode: `#${string}`,
widthRange?: [number, number],
heightRange?: [number, number],
likeEqualColor: LikeEqualColor = equalColor,
Expand All @@ -103,12 +103,12 @@ export function bucketFill(
const data = imageData.data;
const formattedData = rawToColors(data, width, height);
const targetColor = formattedData[y][x];
const colorObj = hexToColor(color);
if (colorObj === null) {
const color = hexToColor(colorCode);
if (color === null) {
console.error("invalid color");
return;
}
if (likeEqualColor(colorObj, targetColor)) return;
if (likeEqualColor(color, targetColor)) return;

const xRange = widthRange ?? [0, width];
const yRange = heightRange ?? [0, height];
Expand All @@ -124,7 +124,7 @@ export function bucketFill(
formattedData,
x,
y,
colorObj,
color,
xRange,
targetColor,
likeEqualColor,
Expand All @@ -134,7 +134,7 @@ export function bucketFill(
formattedData,
x,
y,
colorObj,
color,
xRange,
targetColor,
likeEqualColor,
Expand Down

0 comments on commit 79f2108

Please sign in to comment.