图层代码备用
This commit is contained in:
parent
bd4ee6a5a6
commit
627dcea9fd
@ -99,6 +99,25 @@ const RedoOptions: MenuItemOptions = {
|
||||
const SelectAllOptions: MenuItemOptions = {
|
||||
name: '全选',
|
||||
};
|
||||
const oneLayerOptions: MenuItemOptions = {
|
||||
name: '图层一',
|
||||
};
|
||||
const twoLayerOptions: MenuItemOptions = {
|
||||
name: '图层二',
|
||||
};
|
||||
const threeLayerOptions: MenuItemOptions = {
|
||||
name: '图层三',
|
||||
};
|
||||
|
||||
const layerOptions: MenuItemOptions = {
|
||||
name: '图层',
|
||||
subMenu: [
|
||||
{
|
||||
name: '图层菜单',
|
||||
items: [oneLayerOptions, twoLayerOptions, threeLayerOptions],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const DefaultCanvasMenu = new ContextMenu({
|
||||
name: '绘制-画布菜单',
|
||||
@ -109,6 +128,9 @@ export const DefaultCanvasMenu = new ContextMenu({
|
||||
{
|
||||
items: [SelectAllOptions],
|
||||
},
|
||||
{
|
||||
items: [layerOptions],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@ -179,6 +201,12 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
if (app._drawing) return;
|
||||
UndoOptions.disabled = !app.opRecord.hasUndo;
|
||||
RedoOptions.disabled = !app.opRecord.hasRedo;
|
||||
const axleCountings = app.queryStore.queryByType<AxleCounting>(
|
||||
AxleCounting.Type
|
||||
);
|
||||
const trainWindows = app.queryStore.queryByType<TrainWindow>(
|
||||
TrainWindow.Type
|
||||
);
|
||||
UndoOptions.handler = () => {
|
||||
app.opRecord.undo();
|
||||
};
|
||||
@ -188,6 +216,24 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
SelectAllOptions.handler = () => {
|
||||
app.selectAllGraphics();
|
||||
};
|
||||
oneLayerOptions.handler = () => {
|
||||
axleCountings.forEach((axleCounting) => {
|
||||
axleCounting.visible = false;
|
||||
});
|
||||
};
|
||||
twoLayerOptions.handler = () => {
|
||||
trainWindows.forEach((trainWindow) => {
|
||||
trainWindow.visible = false;
|
||||
});
|
||||
};
|
||||
threeLayerOptions.handler = () => {
|
||||
axleCountings.forEach((axleCounting) => {
|
||||
axleCounting.visible = true;
|
||||
});
|
||||
trainWindows.forEach((trainWindow) => {
|
||||
trainWindow.visible = true;
|
||||
});
|
||||
};
|
||||
DefaultCanvasMenu.open(e.global);
|
||||
});
|
||||
app.addKeyboardListener(
|
||||
|
Loading…
Reference in New Issue
Block a user