Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow externally updated props to change the viewer even if OSD is still animating a change. #3986

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/components/OpenSeadragonViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class OpenSeadragonViewer extends Component {
this.onCanvasMouseMove = debounce(this.onCanvasMouseMove.bind(this), 10);
this.onViewportChange = this.onViewportChange.bind(this);
this.zoomToWorld = this.zoomToWorld.bind(this);
this.osdUpdating = false;
}

/**
Expand Down Expand Up @@ -72,14 +71,7 @@ export class OpenSeadragonViewer extends Component {
this.setState({ grabbing: false });
});

// Set a flag when OSD starts animating (so that viewer updates are not used)
viewer.addHandler('animation-start', () => {
this.osdUpdating = true;
});
viewer.addHandler('animation-finish', this.onViewportChange);
viewer.addHandler('animation-finish', () => {
this.osdUpdating = false;
});

if (viewer.innerTracker) {
viewer.innerTracker.moveHandler = this.onCanvasMouseMove;
Expand Down Expand Up @@ -127,7 +119,7 @@ export class OpenSeadragonViewer extends Component {
}
} else if (!isEqual(canvasWorld.layers, prevProps.canvasWorld.layers)) {
this.refreshTileProperties();
} else if (viewerConfig && !this.osdUpdating) {
} else if (viewerConfig !== prevProps.viewerConfig) {
const { viewport } = viewer;

if (viewerConfig.x !== viewport.centerSpringX.target.value
Expand Down
Loading