mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Improve scrollbar-mouse interaction (#667)
* fix scrollbar detection on high devicePixelRatio devices * don't create a new element on pointerdown over a scrollbar * Return scrollbars from renderScene and use it in isOverScrollBars * remove unneeded setState * show default cursor when hovering or dragging a scrollbar * disable scrollbars when in multielement mode Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
8e0206cc1e
commit
e920c078b9
4 changed files with 109 additions and 45 deletions
|
@ -36,9 +36,9 @@ export function renderScene(
|
|||
renderSelection?: boolean;
|
||||
renderOptimizations?: boolean;
|
||||
} = {},
|
||||
): boolean {
|
||||
) {
|
||||
if (!canvas) {
|
||||
return false;
|
||||
return { atLeastOneVisibleElement: false };
|
||||
}
|
||||
|
||||
const context = canvas.getContext("2d")!;
|
||||
|
@ -196,9 +196,10 @@ export function renderScene(
|
|||
}
|
||||
});
|
||||
context.restore();
|
||||
return { atLeastOneVisibleElement: visibleElements.length > 0, scrollBars };
|
||||
}
|
||||
|
||||
return visibleElements.length > 0;
|
||||
return { atLeastOneVisibleElement: visibleElements.length > 0 };
|
||||
}
|
||||
|
||||
function isVisibleElement(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue