Я хочу использовать метки с draw2d (из draw2d.org), но проблема в том, что они будут находиться под другими объектами, поэтому для их перетаскивания они должны быть единственным объектом на странице.Я попытался использовать метод toFront (), но это вызовет проблему, и ни одно из соединений не будет отображено.
draw2d.shape.bpmn.Connection = draw2d.Connection.extend({
NAME: "draw2d.shape.bpmn.Connection",
init: function (attr, setter, getter) {
this._super($.extend({
router: new draw2d.layout.connection.InteractiveManhattanConnectionRouter(),
stroke: 1,
}, attr), setter, getter);
this.setTargetDecorator(new draw2d.decoration.connection.ArrowDecorator(17, 8));
this.label = new draw2d.shape.basic.Label({
text: "Label",
fontColor: "#0d0d0d",
});
this.add(this.label, new draw2d.layout.locator.ConnectionLabelLocator());
//this.toFront(this.label);
// this.toFront(this.label)
//this.label.installEditor(new draw2d.ui.LabelInplaceEditor());
//this.toFront(this.getParent());
},
onInstall: function (conn) {
this._super();
}});
draw2d.layout.locator.TuiConnectionLabelLocator = draw2d.layout.locator.PolylineMidpointLocator.extend({
NAME: "draw2d.layout.locator.ConnectionLabelLocator",
init: function () {
this._super();
},
bind: function (parent, child) {
child.setSelectionAdapter(function () {
return child;
});
},
unbind: function (parent, child) {
child.setSelectionAdapter(null);
}
});