我对sencha ext js很陌生,如何通过单击按钮来禁用onMouseDown,防止用户在画布上绘图。
分机js 6.5.2
这是视图
tbar: ['->', {
text: 'Disable',
handler: function () {
// Remove all the sprites and redraw.
onMouseDown.setDisabled()(!onMouseDown.isDisabled());
this.setText(action.isDisabled() ? 'Enable' : 'Disable');
}],这是组件
onMouseDown: function (e) {
var targetElement = this,
me = Ext.getCmp(targetElement.id),
surface = me.getSurface(),
xy, x, y;
if (!me.sprite) {
xy = surface.getEventXY(e);
x = xy[0];
y = xy[1];
me.list = [x, y, x, y];
me.lastEventX = x;
me.lastEventY = y;
me.sprite = surface.add({
type: 'path',
path: ['M', me.list[0], me.list[1], 'L', me.list[0] + 1e-1, me.list[1] + 1e-1],
lineWidth: 20,
lineCap: 'round',
lineJoin: 'round',
draggable: 'true',
strokeStyle: new Ext.util.Color(0,0,0)
});
surface.renderFrame();
}
}https://stackoverflow.com/questions/48071725
复制相似问题