* Base axis pointer class in 2D.
| 93 | * Base axis pointer class in 2D. |
| 94 | */ |
| 95 | class BaseAxisPointer implements AxisPointer { |
| 96 | |
| 97 | private _group: graphic.Group; |
| 98 | |
| 99 | private _lastGraphicKey: string; |
| 100 | |
| 101 | private _handle: Icon; |
| 102 | |
| 103 | private _dragging = false; |
| 104 | |
| 105 | private _lastValue: AxisValue; |
| 106 | |
| 107 | private _lastStatus: CommonAxisPointerOption['status']; |
| 108 | |
| 109 | private _payloadInfo: ReturnType<BaseAxisPointer['updateHandleTransform']>; |
| 110 | |
| 111 | /** |
| 112 | * If have transition animation |
| 113 | */ |
| 114 | private _moveAnimation: boolean; |
| 115 | |
| 116 | private _axisModel: AxisBaseModel; |
| 117 | private _axisPointerModel: AxisPointerModel; |
| 118 | private _api: ExtensionAPI; |
| 119 | |
| 120 | /** |
| 121 | * In px, arbitrary value. Do not set too small, |
| 122 | * no animation is ok for most cases. |
| 123 | */ |
| 124 | protected animationThreshold = 15; |
| 125 | |
| 126 | /** |
| 127 | * @implement |
| 128 | */ |
| 129 | render(axisModel: AxisBaseModel, axisPointerModel: AxisPointerModel, api: ExtensionAPI, forceRender?: boolean) { |
| 130 | const value = axisPointerModel.get('value'); |
| 131 | const status = axisPointerModel.get('status'); |
| 132 | |
| 133 | // Bind them to `this`, not in closure, otherwise they will not |
| 134 | // be replaced when user calling setOption in not merge mode. |
| 135 | this._axisModel = axisModel; |
| 136 | this._axisPointerModel = axisPointerModel; |
| 137 | this._api = api; |
| 138 | |
| 139 | // Optimize: `render` will be called repeatedly during mouse move. |
| 140 | // So it is power consuming if performing `render` each time, |
| 141 | // especially on mobile device. |
| 142 | if (!forceRender |
| 143 | && this._lastValue === value |
| 144 | && this._lastStatus === status |
| 145 | ) { |
| 146 | return; |
| 147 | } |
| 148 | this._lastValue = value; |
| 149 | this._lastStatus = status; |
| 150 | |
| 151 | let group = this._group; |
| 152 | const handle = this._handle; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…