(
roamType: RoamOptionMixin['roam'],
)
| 219 | } |
| 220 | |
| 221 | private _resetRoamController( |
| 222 | roamType: RoamOptionMixin['roam'], |
| 223 | ): void { |
| 224 | const api = this._api; |
| 225 | |
| 226 | let roamController = this._roamController; |
| 227 | if (!roamController) { |
| 228 | roamController = this._roamController = new RoamController(api.getZr()); |
| 229 | } |
| 230 | |
| 231 | if (!roamType || !this._isEnabled()) { |
| 232 | roamController.disable(); |
| 233 | return; |
| 234 | } |
| 235 | |
| 236 | roamController.enable(roamType, { |
| 237 | api: api, |
| 238 | zInfo: {component: this._model}, |
| 239 | triggerInfo: { |
| 240 | roamTrigger: null, |
| 241 | isInSelf: (e, x, y) => this._contentRect.contain(x, y) |
| 242 | } |
| 243 | }); |
| 244 | roamController |
| 245 | .off('pan') |
| 246 | .off('zoom') |
| 247 | .on('pan', bind(this._onPan, this)) |
| 248 | .on('zoom', bind(this._onZoom, this)); |
| 249 | // PENDING: Currently roaming animation (when roaming args are changed; |
| 250 | // e.g., `center` and `zoom` are changed) is not supported in thumbnail. |
| 251 | // Animation should be able to be interrupted on pan and zoom, and synchronize |
| 252 | // back to the target. See VIEW_COORD_SYS_ANIMATION. |
| 253 | } |
| 254 | |
| 255 | private _onPan(event: RoamEventParams['pan']): void { |
| 256 | const trans = this._transThisToTarget; |
no test coverage detected