Add Select All

This commit is contained in:
Skyler Lehmkuhl 2024-12-16 18:42:58 -05:00
parent 555cf65a9a
commit dc2f772da3
1 changed files with 45 additions and 2 deletions

View File

@ -104,11 +104,29 @@ let tools = {
}, },
rectangle: { rectangle: {
icon: "/assets/rectangle.svg", icon: "/assets/rectangle.svg",
properties: {} properties: {
"lineWidth": {
type: "number",
label: "Line Width"
},
"fillShape": {
type: "boolean",
label: "Fill Shape"
}
}
}, },
ellipse: { ellipse: {
icon: "assets/ellipse.svg", icon: "assets/ellipse.svg",
properties: {} properties: {
"lineWidth": {
type: "number",
label: "Line Width"
},
"fillShape": {
type: "boolean",
label: "Fill Shape"
}
}
}, },
paint_bucket: { paint_bucket: {
icon: "/assets/paint_bucket.svg", icon: "/assets/paint_bucket.svg",
@ -165,6 +183,7 @@ let config = {
copy: "<mod>c", copy: "<mod>c",
paste: "<mod>v", paste: "<mod>v",
delete: "Backspace", delete: "Backspace",
selectAll: "<mod>a",
group: "<mod>g", group: "<mod>g",
zoomIn: "<mod>+", zoomIn: "<mod>+",
zoomOut: "<mod>-", zoomOut: "<mod>-",
@ -2112,6 +2131,10 @@ window.addEventListener("keydown", (e) => {
case config.shortcuts.delete: case config.shortcuts.delete:
delete_action() delete_action()
break; break;
case config.shortcuts.selectAll:
selectAll()
e.preventDefault()
break;
case config.shortcuts.group: case config.shortcuts.group:
actions.group.create() actions.group.create()
break; break;
@ -2447,6 +2470,21 @@ function delete_action() {
updateUI() updateUI()
} }
function selectAll() {
context.selection = []
context.shapeselection = []
for (let child of context.activeObject.activeLayer.children) {
let idx = child.idx
if (idx in context.activeObject.currentFrame.keys) {
context.selection.push(child)
}
}
for (let shape of context.activeObject.currentFrame.shapes) {
context.shapeselection.push(shape)
}
updateUI()
}
function addFrame() { function addFrame() {
if (context.activeObject.currentFrameNum >= context.activeObject.activeLayer.frames.length) { if (context.activeObject.currentFrameNum >= context.activeObject.activeLayer.frames.length) {
actions.addFrame.create() actions.addFrame.create()
@ -3980,6 +4018,11 @@ async function updateMenu() {
enabled: (context.selection.length > 0 || context.shapeselection.length > 0), enabled: (context.selection.length > 0 || context.shapeselection.length > 0),
action: delete_action action: delete_action
}, },
{
text: "Select All",
enabled: true,
action: selectAll
},
] ]
}); });