Fix map interaction
This commit is contained in:
parent
f783a9bb70
commit
54a60d6c76
@ -89,6 +89,7 @@ function MapInteraction({
|
|||||||
stageScale,
|
stageScale,
|
||||||
setStageScale,
|
setStageScale,
|
||||||
stageTranslateRef,
|
stageTranslateRef,
|
||||||
|
selectedToolId,
|
||||||
preventMapInteraction,
|
preventMapInteraction,
|
||||||
{
|
{
|
||||||
onPinchStart: () => {
|
onPinchStart: () => {
|
||||||
|
@ -12,6 +12,7 @@ function useStageInteraction(
|
|||||||
stageScale,
|
stageScale,
|
||||||
onStageScaleChange,
|
onStageScaleChange,
|
||||||
stageTranslateRef,
|
stageTranslateRef,
|
||||||
|
tool = "pan",
|
||||||
preventInteraction = false,
|
preventInteraction = false,
|
||||||
gesture = {}
|
gesture = {}
|
||||||
) {
|
) {
|
||||||
@ -89,6 +90,7 @@ function useStageInteraction(
|
|||||||
|
|
||||||
const [dx, dy] = delta;
|
const [dx, dy] = delta;
|
||||||
const stageTranslate = stageTranslateRef.current;
|
const stageTranslate = stageTranslateRef.current;
|
||||||
|
if (tool === "pan") {
|
||||||
const newTranslate = {
|
const newTranslate = {
|
||||||
x: stageTranslate.x + dx / stageScale,
|
x: stageTranslate.x + dx / stageScale,
|
||||||
y: stageTranslate.y + dy / stageScale,
|
y: stageTranslate.y + dy / stageScale,
|
||||||
@ -97,6 +99,7 @@ function useStageInteraction(
|
|||||||
layer.y(newTranslate.y);
|
layer.y(newTranslate.y);
|
||||||
layer.draw();
|
layer.draw();
|
||||||
stageTranslateRef.current = newTranslate;
|
stageTranslateRef.current = newTranslate;
|
||||||
|
}
|
||||||
gesture.onDrag && gesture.onDrag(props);
|
gesture.onDrag && gesture.onDrag(props);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user