Skip to content

Commit e154364

Browse files
committed
Fix overwriting values on opening file
1 parent 4a95116 commit e154364

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

packages/base/src/mainview/mainView.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,9 +2113,14 @@ export class MainView extends React.Component<IProps, IStates> {
21132113
const currentZoom = view.getZoom() || 0;
21142114
const targetCenter: Coordinate = [center.x, center.y];
21152115

2116-
if (transitionType === 'immediate') {
2117-
view.setCenter(targetCenter);
2118-
view.setZoom(zoom);
2116+
if (transitionType === 'linear') {
2117+
// Linear: direct zoom
2118+
view.animate({
2119+
center: targetCenter,
2120+
zoom: zoom,
2121+
duration,
2122+
});
2123+
21192124
return;
21202125
}
21212126

@@ -2140,14 +2145,13 @@ export class MainView extends React.Component<IProps, IStates> {
21402145
duration: duration * 0.5,
21412146
},
21422147
);
2143-
} else {
2144-
// Linear: direct zoom
2145-
view.animate({
2146-
center: targetCenter,
2147-
zoom: zoom,
2148-
duration,
2149-
});
2148+
2149+
return;
21502150
}
2151+
2152+
// Immediate move
2153+
view.setCenter(targetCenter);
2154+
view.setZoom(zoom);
21512155
}
21522156

21532157
private _onPointerMove(e: MouseEvent) {

0 commit comments

Comments
 (0)