(seriesModel: TreeSeriesModel, api: ExtensionAPI)
| 250 | } |
| 251 | |
| 252 | private _updateViewCoordSys(seriesModel: TreeSeriesModel, api: ExtensionAPI) { |
| 253 | const data = seriesModel.getData(); |
| 254 | const points: number[][] = []; |
| 255 | data.each(function (idx) { |
| 256 | const layout = data.getItemLayout(idx); |
| 257 | if (layout && !isNaN(layout.x) && !isNaN(layout.y)) { |
| 258 | points.push([+layout.x, +layout.y]); |
| 259 | } |
| 260 | }); |
| 261 | const min: number[] = []; |
| 262 | const max: number[] = []; |
| 263 | bbox.fromPoints(points, min, max); |
| 264 | |
| 265 | // If don't Store min max when collapse the root node after roam, |
| 266 | // the root node will disappear. |
| 267 | const oldMin = this._min; |
| 268 | const oldMax = this._max; |
| 269 | |
| 270 | // If width or height is 0 |
| 271 | if (max[0] - min[0] === 0) { |
| 272 | min[0] = oldMin ? oldMin[0] : min[0] - 1; |
| 273 | max[0] = oldMax ? oldMax[0] : max[0] + 1; |
| 274 | } |
| 275 | if (max[1] - min[1] === 0) { |
| 276 | min[1] = oldMin ? oldMin[1] : min[1] - 1; |
| 277 | max[1] = oldMax ? oldMax[1] : max[1] + 1; |
| 278 | } |
| 279 | |
| 280 | // Here we use viewCoordSys just for computing the 'position' and 'scale' of the group, |
| 281 | // and 'treeRoam' action. |
| 282 | const ownCoordSys = seriesModel.coordinateSystem = createViewCoordSysSimply( |
| 283 | seriesModel, |
| 284 | api, |
| 285 | min[0], min[1], max[0] - min[0], max[1] - min[1] |
| 286 | ); |
| 287 | |
| 288 | applyViewCoordSysTransToElement( |
| 289 | this.group, |
| 290 | VIEW_COORD_SYS_TRANS_OVERALL, |
| 291 | ownCoordSys, |
| 292 | this._firstRender ? null : seriesModel, |
| 293 | ); |
| 294 | |
| 295 | this._min = min; |
| 296 | this._max = max; |
| 297 | } |
| 298 | |
| 299 | _updateNodeAndLinkScale(seriesModel: TreeSeriesModel) { |
| 300 | const data = seriesModel.getData(); |
no test coverage detected