61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
|
|
function PalettePlugin(palette, lassoTool, create, elementFactory, globalConnect) {
|
||
|
|
palette.registerProvider({
|
||
|
|
getPaletteEntries: () => ({
|
||
|
|
'hand-tool': {
|
||
|
|
group: 'tools',
|
||
|
|
className: 'icon-hand-tool',
|
||
|
|
title: 'Hand Tool',
|
||
|
|
action: {
|
||
|
|
click: function(event) {
|
||
|
|
console.log("Hello");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
'lasso-tool': {
|
||
|
|
group: 'tools',
|
||
|
|
className: 'icon-lasso-tool',
|
||
|
|
title: 'Lasso Tool',
|
||
|
|
action: {
|
||
|
|
click: function(event) {
|
||
|
|
lassoTool.activateSelection(event);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
'tool-separator': {
|
||
|
|
group: 'tools',
|
||
|
|
separator: true
|
||
|
|
},
|
||
|
|
'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-connection': {
|
||
|
|
group: 'create',
|
||
|
|
className: 'connection-create-shape',
|
||
|
|
title: 'Create Connection',
|
||
|
|
action: {
|
||
|
|
click: (event) => {
|
||
|
|
globalConnect.start(event);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
export default {
|
||
|
|
__init__: [ 'palettePlugin' ],
|
||
|
|
palettePlugin: [ 'type', PalettePlugin ]
|
||
|
|
};
|