'多角形選択を完了しました');
}
function magicWandSelect(x,y,tolerance){
const imageData=ctx.getImageData(0,0,canvas.width,canvas.height);
const targetColor=getPixelColor(imageData,x,y);
const stack=[{x,y}];
const visited=new Set();
while(stack.length){
const pixel=stack.pop();
const key=`${pixel.x},${pixel.y}`;
if(visited.has(key))continue;
visited.add(key);
const color=getPixelColor(imageData,pixel.x,pixel.y);
if(colorDistance(targetColor,color)<=tolerance){
maskCtx.fillStyle=colorPicker.value;