mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-11-01 13:20:16 +08:00
1 parent
b0f0a2c7c5
commit
1e2c5f6e38
2 files changed
+6
-6
No files matched your search
@@ -743,8 +743,8 @@ const canvasEditor = new CanvasEditor(el.viewerPanel, {
|
||||
onPage: (index) => {
|
||||
if (index !== state.pageIndex) pageView.setCurrentPage(index);
|
||||
},
|
||||
onSelect: (item, previous) => {
|
||||
if (item && item.index !== state.pageIndex) pageView.setCurrentPage(item.index);
|
||||
onSelect: (item, previous, restoring) => {
|
||||
if (!restoring && item && item.index !== state.pageIndex) pageView.setCurrentPage(item.index);
|
||||
updateObjectControls(item);
|
||||
const reason = objectEditReason(item), previousReason = objectEditReason(previous);
|
||||
if (state.editing && state.doc && !document.body.hasAttribute("data-busy")
|
||||
@@ -1858,7 +1858,7 @@ document.querySelector("#objectActionsButton").addEventListener("click", async (
|
||||
settingsElements.Tabs.hidden = true;
|
||||
});
|
||||
el.outlinesTab.addEventListener("click", () => showNavigation(el.outlinesTab));
|
||||
el.searchTab.addEventListener("click", focusSearch);
|
||||
el.searchTab.addEventListener("click", () => focusSearch());
|
||||
el.navigationTabs.addEventListener("keydown", (event) => {
|
||||
if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
|
||||
return;
|
||||
|
||||
@@ -944,7 +944,7 @@ export class CanvasEditor {
|
||||
}
|
||||
this.pages.set(surface, { index, width: page.width, height: page.height, hitIndex: new ObjectIndex(items) });
|
||||
surface.append(layer);
|
||||
if (pending || selected.size) this.setSelection(selection);
|
||||
if (pending || selected.size) this.setSelection(selection, true);
|
||||
if (pending) this.pendingSelection = null;
|
||||
if (crop && selection.length === 1 && selection[0].id === crop.item.id
|
||||
&& ["x", "y", "width", "height"].every(key => selection[0][key] === crop.item[key])) {
|
||||
@@ -1049,7 +1049,7 @@ export class CanvasEditor {
|
||||
return this.selected?.items || (this.selected ? [this.selected] : []);
|
||||
}
|
||||
|
||||
setSelection(items) {
|
||||
setSelection(items, restoring = false) {
|
||||
items = items.filter(item => !items.some(parent => parent !== item && item.id.startsWith(parent.id + "/")));
|
||||
this.cancelNudge();
|
||||
const previous = this.selected;
|
||||
@@ -1100,7 +1100,7 @@ export class CanvasEditor {
|
||||
for (const item of items) {
|
||||
if (item.parent) this.pageItems(item.index).find(parent => parent.id === item.parent)?.node.classList.add("edit-parent");
|
||||
}
|
||||
this.options.onSelect(this.selected, previous);
|
||||
this.options.onSelect(this.selected, previous, restoring);
|
||||
}
|
||||
|
||||
select(item, add = false) {
|
||||
|
||||
Reference in new issue
Block a user