Fix selection tools, add float selection, aspect ratio lock, U2net auto-download

- Fix brush_select and smart_select mask scaling to match layer dimensions
- Add "Float Selection" feature to Select tool - when switching to Select
  with an active AI selection, offers to copy it to a movable layer
- Add aspect ratio lock toggle (🔗 button) in layer details panel
- When locked, changing width auto-updates height and vice versa
- Add U2net model auto-download - will download lightweight u2netp.onnx (~4MB)
  automatically if no model found
- Improve error messages for background removal
- Register on_activate for select tool in config

Workflow: Select object with AI tool → Click Select tool → "Float" selection
→ Move/scale the floated layer freely

https://claude.ai/code/session_01CLedz6CanT9t46KBvng3vz
This commit is contained in:
Claude
2026-01-27 22:59:22 +00:00
parent 549a1a4e82
commit e26c914483
6 changed files with 247 additions and 5 deletions
+6 -2
View File
@@ -327,10 +327,14 @@ class Brush_select_class extends Base_tools_class {
canvas.width = config.layer.width_original;
canvas.height = config.layer.height_original;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
// Scale the mask image to match the layer dimensions
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
resolve(canvas);
};
img.onerror = reject;
img.onerror = function(e) {
console.error('Failed to decode mask image:', e);
reject(e);
};
img.src = 'data:image/png;base64,' + maskBase64;
});
}