Add files via upload
This commit is contained in:
parent
392aebe0df
commit
a3243dd1ba
14 changed files with 871 additions and 0 deletions
89
CustomPaletteModule.ts
Normal file
89
CustomPaletteModule.ts
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
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': {
|
||||
group: 'tools',
|
||||
className: 'icon-hand-tool',
|
||||
title: 'Hand Tool',
|
||||
action: {
|
||||
click: function() {
|
||||
//console.log("Hello");
|
||||
}
|
||||
}
|
||||
},
|
||||
'lasso-tool': {
|
||||
group: 'tools',
|
||||
className: 'icon-lasso-tool',
|
||||
title: 'Lasso Tool',
|
||||
action: {
|
||||
click: function(event) {
|
||||
lassoTool.activateSelection(event as MouseEvent);
|
||||
}
|
||||
}
|
||||
},
|
||||
'tool-separator': {
|
||||
group: 'tools',
|
||||
separator: true,
|
||||
action: {}
|
||||
},
|
||||
'create-shape': {
|
||||
group: 'create',
|
||||
className: 'icon-create-shape',
|
||||
title: 'Create Shape',
|
||||
action: {
|
||||
click: function() {
|
||||
var shape = elementFactory.createShape({
|
||||
width: 100,
|
||||
height: 80,
|
||||
canStartConnection:true
|
||||
});
|
||||
console.log(shape.canStartConnection);
|
||||
create.start(event, shape);
|
||||
}
|
||||
}
|
||||
},
|
||||
'create-device': {
|
||||
group: 'create',
|
||||
className: 'icon-create-shape',
|
||||
title: 'Create Device',
|
||||
action: {
|
||||
click: function() {
|
||||
var shape = elementFactory.createShape({
|
||||
width: 100,
|
||||
height: 80,
|
||||
canStartConnection:true,
|
||||
type: 'custom:circle'
|
||||
});
|
||||
console.log(shape.canStartConnection);
|
||||
create.start(event, shape);
|
||||
}
|
||||
}
|
||||
},
|
||||
'create-connection': {
|
||||
group: 'create',
|
||||
className: 'icon-connect',
|
||||
title: 'Create Connection',
|
||||
action: {
|
||||
click: (event) => {
|
||||
globalConnect.start(event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
__init__: [ 'palettePlugin' ],
|
||||
palettePlugin: [ 'type', PalettePlugin ]
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue