__onmousedown: function (param) { if (param.target) { return; } this._zooming = true; var x = zrEvent.getX(param.event); var y = zrEvent.getY(param.event); var zoomOption = this.option.dataZoom || {}; this._zoomShape = new RectangleShape({ zlevel: this.getZlevelBase(), z: this.getZBase(), style: { x: x, y: y, width: 1, height: 1, brushType: 'both' }, highlightStyle: { lineWidth: 2, color: zoomOption.fillerColor || ecConfig.dataZoom.fillerColor, strokeColor: zoomOption.handleColor || ecConfig.dataZoom.handleColor, brushType: 'both' } }); this.zr.addHoverShape(this._zoomShape); return true; // 阻塞全局事件 },
__onmousemove: function (param) { if (this._marking) { this._markShape.style.xEnd = zrEvent.getX(param.event); this._markShape.style.yEnd = zrEvent.getY(param.event); this.zr.addHoverShape(this._markShape); } if (this._zooming) { this._zoomShape.style.width = zrEvent.getX(param.event) - this._zoomShape.style.x; this._zoomShape.style.height = zrEvent.getY(param.event) - this._zoomShape.style.y; this.zr.addHoverShape(this._zoomShape); this.dom.style.cursor = 'crosshair'; zrEvent.stop(param.event); } if (this._zoomStart && (this.dom.style.cursor != 'pointer' && this.dom.style.cursor != 'move') ) { this.dom.style.cursor = 'crosshair'; } },
__onclick: function (param) { if (param.target) { return; } if (this._marking) { this._marking = false; this._markShapeList.push(this._markShape); this._iconEnable(this._iconShapeMap['markUndo']); this._iconEnable(this._iconShapeMap['markClear']); this.zr.addShape(this._markShape); this.zr.refreshNextFrame(); } else if (this._markStart) { this._marking = true; var x = zrEvent.getX(param.event); var y = zrEvent.getY(param.event); this._markShape = new LineShape({ zlevel: this.getZlevelBase(), z: this.getZBase(), style: { xStart: x, yStart: y, xEnd: x, yEnd: y, lineWidth: this.query( this.option, 'toolbox.feature.mark.lineStyle.width' ), strokeColor: this.query( this.option, 'toolbox.feature.mark.lineStyle.color' ), lineType: this.query( this.option, 'toolbox.feature.mark.lineStyle.type' ) } }); this.zr.addHoverShape(this._markShape); } },