feat(interaction): add zoomOnDoublickClick and fix behaviour closes #338

This commit is contained in:
moklick
2020-07-17 11:04:32 +02:00
parent a40f5adc03
commit 42f6336171
5 changed files with 47 additions and 16 deletions
+3 -1
View File
@@ -349,6 +349,7 @@ export const storeModel: StoreModel = {
initD3: action((state, zoomPaneNode) => {
const d3ZoomInstance = zoom().scaleExtent([state.minZoom, state.maxZoom]);
const selection = select(zoomPaneNode).call(d3ZoomInstance);
state.d3Zoom = d3ZoomInstance;
@@ -413,7 +414,8 @@ export const storeModel: StoreModel = {
const transform = [width / 2 - boundsCenterX * k, height / 2 - boundsCenterY * k];
const fittedTransform = zoomIdentity.translate(transform[0], transform[1]).scale(k);
d3Selection.call(d3Zoom.transform, fittedTransform);
// we need to sync the d3 zoom transform with the fitted transform
d3Selection.property('__zoom', fittedTransform);
state.transform = [fittedTransform.x, fittedTransform.y, fittedTransform.k];
}),