Skip to content

Commit 4175922

Browse files
committed
fix: (1) Fix geo roam (pan and zoom) causes visual artifacts -- geo coord sys and its content (e.g., scatter) should visually align during roaming animation and manual roam. (2) Refactor to uniform roaming impl (via RoamController and ViewCoordSys) and clarify updateTransform and related code. (3) Enable scatter and effectScatter clip in geo. (4) Fix aria: palette is modified to ec instance local rather than global, which is more reasonable. (5) Fix map series roaming bug: roam and then click legend hide the first series and then roam and then click legend to restore the first series, the map should not jump.
1 parent 505dbed commit 4175922

84 files changed

Lines changed: 3277 additions & 1883 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/animation/basicTransition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function animateOrSetProps<Props>(
216216
* position: [100, 100]
217217
* }, seriesModel, function () { console.log('Animation done!'); });
218218
*/
219-
function updateProps<Props extends ElementProps>(
219+
function updateProps<Props extends ElementProps>(
220220
el: Element<Props>,
221221
props: Props,
222222
// TODO: TYPE AnimatableModel

src/chart/effectScatter/EffectScatterSeries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import {
3838
} from '../../util/types';
3939
import GlobalModel from '../../model/Global';
4040
import SeriesData from '../../data/SeriesData';
41-
import type { SymbolDrawItemModelOption } from '../helper/SymbolDraw';
4241
import { BrushCommonSelectorsForSeries } from '../../component/brush/selector';
42+
import { SymbolDrawItemModelOption } from '../helper/baseDraw';
4343

4444
type ScatterDataValue = OptionDataValue | OptionDataValue[];
4545

src/chart/effectScatter/EffectScatterView.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import GlobalModel from '../../model/Global';
2727
import ExtensionAPI from '../../core/ExtensionAPI';
2828
import EffectScatterSeriesModel from './EffectScatterSeries';
2929
import { StageHandlerProgressExecutor } from '../../util/types';
30+
import { createCoordSysClipAreaSimply } from '../helper/createClipPathFromCoordSys';
31+
import { SymbolDrawUpdateOpt } from '../helper/baseDraw';
3032

3133
class EffectScatterView extends ChartView {
3234
static readonly type = 'effectScatter';
@@ -41,16 +43,10 @@ class EffectScatterView extends ChartView {
4143
render(seriesModel: EffectScatterSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
4244
const data = seriesModel.getData();
4345
const effectSymbolDraw = this._symbolDraw;
44-
effectSymbolDraw.updateData(data, {clipShape: this._getClipShape(seriesModel)});
46+
effectSymbolDraw.updateData(data, createSymbolDrawOpt(seriesModel));
4547
this.group.add(effectSymbolDraw.group);
4648
}
4749

48-
_getClipShape(seriesModel: EffectScatterSeriesModel) {
49-
const coordSys = seriesModel.coordinateSystem;
50-
const clipArea = coordSys && coordSys.getArea && coordSys.getArea();
51-
return seriesModel.get('clip', true) ? clipArea : null;
52-
}
53-
5450
updateTransform(seriesModel: EffectScatterSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
5551
const data = seriesModel.getData();
5652

@@ -65,7 +61,7 @@ class EffectScatterView extends ChartView {
6561
}, data);
6662
}
6763

68-
this._symbolDraw.updateLayout();
64+
this._symbolDraw.updateLayout(createSymbolDrawOpt(seriesModel));
6965
}
7066

7167
_updateGroupTransform(seriesModel: EffectScatterSeriesModel) {
@@ -79,6 +75,12 @@ class EffectScatterView extends ChartView {
7975
remove(ecModel: GlobalModel, api: ExtensionAPI) {
8076
this._symbolDraw && this._symbolDraw.remove(true);
8177
}
78+
}
8279

80+
function createSymbolDrawOpt(seriesModel: EffectScatterSeriesModel): SymbolDrawUpdateOpt {
81+
return {
82+
clipShape: createCoordSysClipAreaSimply(seriesModel)
83+
};
8384
}
85+
8486
export default EffectScatterView;

src/chart/graph/GraphSeries.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ import {
4545
OptionDataValueNumeric,
4646
CallbackDataParams,
4747
DefaultEmphasisFocus,
48-
PreserveAspectMixin
48+
PreserveAspectMixin,
49+
RoamHostModel
4950
} from '../../util/types';
5051
import SeriesModel from '../../model/Series';
5152
import Graph from '../../data/Graph';
@@ -57,6 +58,7 @@ import { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup';
5758
import { defaultSeriesFormatTooltip } from '../../component/tooltip/seriesFormatTooltip';
5859
import {initCurvenessList, createEdgeMapForCurveness} from '../helper/multipleGraphEdgeHelper';
5960
import tokens from '../../visual/tokens';
61+
import { isViewCoordSys } from '../../coord/View';
6062

6163

6264
type GraphDataValue = OptionDataValue | OptionDataValue[];
@@ -170,11 +172,6 @@ export interface GraphSeriesOption
170172
*/
171173
focusNodeAdjacency?: boolean
172174

173-
/**
174-
* Symbol size scale ratio in roam
175-
*/
176-
nodeScaleRatio?: number,
177-
178175
draggable?: boolean
179176

180177
edgeSymbol?: string | string[]
@@ -237,7 +234,7 @@ export interface GraphSeriesOption
237234

238235
export const SERIES_TYPE_GRAPH = 'graph';
239236

240-
class GraphSeriesModel extends SeriesModel<GraphSeriesOption> {
237+
class GraphSeriesModel extends SeriesModel<GraphSeriesOption> implements RoamHostModel {
241238
static readonly type = 'series.' + SERIES_TYPE_GRAPH;
242239
readonly type = GraphSeriesModel.type;
243240

@@ -403,20 +400,19 @@ class GraphSeriesModel extends SeriesModel<GraphSeriesOption> {
403400
});
404401
}
405402

406-
setZoom(zoom: number) {
407-
this.option.zoom = zoom;
408-
}
409-
410-
setCenter(center: number[]) {
411-
this.option.center = center;
412-
}
413-
414403
isAnimationEnabled() {
415404
return super.isAnimationEnabled()
416405
// Not enable animation when do force layout
417406
&& !(this.get('layout') === 'force' && this.get(['force', 'layoutAnimation']));
418407
}
419408

409+
__ownRoamView() {
410+
// Be an exclusive coord sys of graph series iff it is a `View` coord sys.
411+
// Otherwise graph series is based on an external geo or Cartesian.
412+
const coordSys = this.coordinateSystem;
413+
return isViewCoordSys(coordSys) && coordSys;
414+
}
415+
420416
static defaultOption: GraphSeriesOption = {
421417
// zlevel: 0,
422418
z: 2,

0 commit comments

Comments
 (0)