pull/3617/head
Mitja Bezenšek 2024-04-25 18:44:32 +02:00
rodzic 453a43f4c0
commit 9308bdedc7
1 zmienionych plików z 2 dodań i 6 usunięć

Wyświetl plik

@ -78,12 +78,8 @@ export function DefaultMinimap() {
minimapRef.current.isInViewport = _vpPageBounds.containsPoint(point)
const commonBounds = Box.Common([editor.getCurrentPageBounds() ?? new Box(), _vpPageBounds])
if (
// If we clicked inside of the allowed area, but outside of the viewport, we wish to move the camera
(commonBounds.containsPoint(point) && !_vpPageBounds.containsPoint(point)) ||
// Or if we clicked slightly outside of the viewport
!minimapRef.current.isInViewport
) {
// If we clicked inside of the allowed area, but outside of the viewport, we wish to move the camera
if (commonBounds.containsPoint(point) && !minimapRef.current.isInViewport) {
const delta = Vec.Sub(_vpPageBounds.center, _vpPageBounds.point)
const pagePoint = Vec.Add(point, delta)
minimapRef.current.originPagePoint.setTo(pagePoint)