MCPcopy
hub / github.com/apache/echarts / _renderHandle

Method _renderHandle

src/component/axisPointer/BaseAxisPointer.ts:338–399  ·  view source on GitHub ↗

* @private

(value: AxisValue)

Source from the content-addressed store, hash-verified

336 * @private
337 */
338 _renderHandle(value: AxisValue) {
339 if (this._dragging || !this.updateHandleTransform) {
340 return;
341 }
342
343 const axisPointerModel = this._axisPointerModel;
344 const zr = this._api.getZr();
345 let handle = this._handle;
346 const handleModel = axisPointerModel.getModel('handle');
347
348 const status = axisPointerModel.get('status');
349 if (!handleModel.get('show') || !status || status === 'hide') {
350 handle && zr.remove(handle);
351 this._handle = null;
352 return;
353 }
354
355 let isInit;
356 if (!this._handle) {
357 isInit = true;
358 handle = this._handle = graphic.createIcon(
359 handleModel.get('icon'),
360 {
361 cursor: 'move',
362 draggable: true,
363 onmousemove(e) {
364 // For mobile device, prevent screen slider on the button.
365 eventTool.stop(e.event);
366 },
367 onmousedown: bind(this._onHandleDragMove, this, 0, 0),
368 drift: bind(this._onHandleDragMove, this),
369 ondragend: bind(this._onHandleDragEnd, this)
370 }
371 );
372 zr.add(handle);
373 }
374
375 updateMandatoryProps(handle, axisPointerModel, false);
376
377 // update style
378 (handle as graphic.Path).setStyle(handleModel.getItemStyle(null, [
379 'color', 'borderColor', 'borderWidth', 'opacity',
380 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'
381 ]));
382
383 // update position
384 let handleSize = handleModel.get('size');
385 if (!zrUtil.isArray(handleSize)) {
386 handleSize = [handleSize, handleSize];
387 }
388 handle.scaleX = handleSize[0] / 2;
389 handle.scaleY = handleSize[1] / 2;
390
391 throttleUtil.createOrUpdate(
392 this,
393 '_doDispatchAxisPointer',
394 handleModel.get('throttle') || 0,
395 'fixRate'

Callers 1

renderMethod · 0.95

Calls 9

_moveHandleToValueMethod · 0.95
updateMandatoryPropsFunction · 0.85
setStyleMethod · 0.80
getItemStyleMethod · 0.80
getZrMethod · 0.65
removeMethod · 0.65
getModelMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected