refactoring
This commit is contained in:
parent
fb8d37548d
commit
f2a72d5155
8 changed files with 52 additions and 114 deletions
|
|
@ -1,4 +1,14 @@
|
|||
function PalettePlugin(palette, lassoTool, create, elementFactory, globalConnect) {
|
||||
import ElementFactory from "diagram-js/lib/core/ElementFactory";
|
||||
import Palette from "diagram-js/lib/features/palette/Palette";
|
||||
import LassoTool from "diagram-js/lib/features/lasso-tool/LassoTool";
|
||||
import Create from "diagram-js/lib/features/create/Create";
|
||||
import GlobalConnect from "diagram-js/lib/features/global-connect/GlobalConnect";
|
||||
|
||||
function PalettePlugin (create: Create,
|
||||
elementFactory:ElementFactory,
|
||||
globalConnect: GlobalConnect,
|
||||
lassoTool: LassoTool,
|
||||
palette: Palette) {
|
||||
palette.registerProvider({
|
||||
getPaletteEntries: () => ({
|
||||
'hand-tool': {
|
||||
|
|
@ -6,7 +16,7 @@ function PalettePlugin(palette, lassoTool, create, elementFactory, globalConnect
|
|||
className: 'icon-hand-tool',
|
||||
title: 'Hand Tool',
|
||||
action: {
|
||||
click: function(event) {
|
||||
click: function() {
|
||||
console.log("Hello");
|
||||
}
|
||||
}
|
||||
|
|
@ -17,13 +27,14 @@ function PalettePlugin(palette, lassoTool, create, elementFactory, globalConnect
|
|||
title: 'Lasso Tool',
|
||||
action: {
|
||||
click: function(event) {
|
||||
lassoTool.activateSelection(event);
|
||||
lassoTool.activateSelection(event as MouseEvent);
|
||||
}
|
||||
}
|
||||
},
|
||||
'tool-separator': {
|
||||
group: 'tools',
|
||||
separator: true
|
||||
separator: true,
|
||||
action: {}
|
||||
},
|
||||
'create-shape': {
|
||||
group: 'create',
|
||||
|
|
@ -47,7 +58,7 @@ function PalettePlugin(palette, lassoTool, create, elementFactory, globalConnect
|
|||
title: 'Create Connection',
|
||||
action: {
|
||||
click: (event) => {
|
||||
globalConnect.start(event);
|
||||
globalConnect.start(event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue