I’m trying to add a hand tool to the editor example’s palette provider using just diagram-js
and I get the following error:
Uncaught Error: No provider for "handTool"! (Resolving: connectPreview -> examplePaletteProvider -> handTool)
.
Any help with resolving this will be greatly appreciated. Thanks!
My code is below:
export default function ExamplePaletteProvider(
palette, create, elementFactory, lassoTool,
handTool) {
this._palette = palette;
this._create = create;
this._elementFactory = elementFactory;
this._lassoTool = lassoTool;
this._handTool = handTool;
palette.registerProvider(this);
}
ExamplePaletteProvider.$inject = [
'palette',
'create',
'elementFactory',
'lassoTool',
'handTool'
];
ExamplePaletteProvider.prototype.getPaletteEntries = function() {
var actions = {},
create = this._create,
elementFactory = this._elementFactory,
lassoTool = this._lassoTool,
handTool = this._handTool;
assign(actions, {
'lasso-tool': {
group: 'tools',
className: 'palette-icon-lasso-tool',
title: 'Activate Lasso Tool',
action: {
click: function(event) {
lassoTool.activateSelection(event);
}
}
},
'hand-tool': {
group: 'tools',
className: 'bpmn-icon-hand-tool',
title: 'Activate the hand tool',
action: {
click: function(event) {
handTool.activateHand(event);
}
}
},
'tool-separator': {
group: 'tools',
separator: true
},
'create-shape': {
group: 'create',
className: 'palette-icon-create-shape',
title: 'Create Shape',
action: {
click: function() {
var shape = elementFactory.createShape({
width: 100,
height: 80
});
create.start(event, shape);
}
}
},
'create-frame': {
group: 'create',
className: 'palette-icon-create-frame',
title: 'Create a big Frame',
action: {
click: function() {
var shape = elementFactory.createShape({
width: 300,
height: 50,
isFrame: true
});
create.start(event, shape);
}
}
}
});
return actions;
};