以下代码在编辑模式下可以正常工作。当我在只读模式下尝试此操作时不起作用。它不在只读模式下加载元素
var ClickableView = joint.dia.ElementView.extend({
pointerdown: function () {
this._click = true;
joint.dia.ElementView.prototype.pointerdown.apply(this, arguments);
},
pointermove: function () {
this._click = false;
joint.dia.ElementView.prototype.pointermove.apply(this, arguments);
},
pointerup: function (evt, x, y) {
if (!$scope.isEditMode) {
joint.dia.ElementView.prototype.pointerup.apply(this, arguments);
logger.info('read only mode, returning');
return;
}
if (this._click) {
// triggers an event on the paper and the element itself
this.notify('cell:click', evt, x, y);
} else {
joint.dia.ElementView.prototype.pointerup.apply(this, arguments);
}
}
});