mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-24 00:14:25 +02:00
Compare commits
2 Commits
release
...
mtolmacs/c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e7c8ed90a | ||
|
|
19b3dc658a |
@@ -23,7 +23,7 @@
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": "18.0.0 - 22.x.x"
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@excalidraw/random-username": "1.0.0",
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"vitest-canvas-mock": "0.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18.0.0 - 22.x.x"
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"homepage": ".",
|
||||
"prettier": "@excalidraw/prettier-config",
|
||||
|
||||
@@ -8,7 +8,7 @@ import { atom, useAtom } from "../editor-jotai";
|
||||
import { getLanguage, t } from "../i18n";
|
||||
|
||||
import Collapsible from "./Stats/Collapsible";
|
||||
import { useDevice } from "./App";
|
||||
import { useDevice, useExcalidrawContainer } from "./App";
|
||||
|
||||
import "./IconPicker.scss";
|
||||
|
||||
@@ -39,6 +39,7 @@ function Picker<T>({
|
||||
numberOfOptionsToAlwaysShow?: number;
|
||||
}) {
|
||||
const device = useDevice();
|
||||
const { container } = useExcalidrawContainer();
|
||||
|
||||
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||
const pressedOption = options.find(
|
||||
@@ -161,6 +162,7 @@ function Picker<T>({
|
||||
sideOffset={isMobile ? 8 : 12}
|
||||
style={{ zIndex: "var(--zIndex-ui-styles-popup)" }}
|
||||
onKeyDown={handleKeyDown}
|
||||
collisionBoundary={container ?? undefined}
|
||||
>
|
||||
<div
|
||||
className={`picker`}
|
||||
|
||||
@@ -40,6 +40,8 @@ export const PropertiesPopover = React.forwardRef<
|
||||
ref,
|
||||
) => {
|
||||
const device = useDevice();
|
||||
const isMobilePortrait =
|
||||
device.editor.isMobile && !device.viewport.isLandscape;
|
||||
|
||||
return (
|
||||
<Popover.Portal container={container}>
|
||||
@@ -47,18 +49,11 @@ export const PropertiesPopover = React.forwardRef<
|
||||
ref={ref}
|
||||
className={clsx("focus-visible-none", className)}
|
||||
data-prevent-outside-click
|
||||
side={
|
||||
device.editor.isMobile && !device.viewport.isLandscape
|
||||
? "bottom"
|
||||
: "right"
|
||||
}
|
||||
align={
|
||||
device.editor.isMobile && !device.viewport.isLandscape
|
||||
? "center"
|
||||
: "start"
|
||||
}
|
||||
side={isMobilePortrait ? "bottom" : "right"}
|
||||
align={isMobilePortrait ? "center" : "start"}
|
||||
alignOffset={-16}
|
||||
sideOffset={20}
|
||||
collisionBoundary={container ?? undefined}
|
||||
style={{
|
||||
zIndex: "var(--zIndex-ui-styles-popup)",
|
||||
marginLeft: device.editor.isMobile ? "0.5rem" : undefined,
|
||||
|
||||
@@ -11,6 +11,8 @@ import { ToolButton } from "./ToolButton";
|
||||
|
||||
import "./ToolPopover.scss";
|
||||
|
||||
import { useExcalidrawContainer } from "./App";
|
||||
|
||||
import type { AppClassProperties } from "../types";
|
||||
|
||||
type ToolOption = {
|
||||
@@ -50,6 +52,7 @@ export const ToolPopover = ({
|
||||
const currentType = activeTool.type;
|
||||
const isActive = displayedOption.type === currentType;
|
||||
const SIDE_OFFSET = 32 / 2 + 10;
|
||||
const { container } = useExcalidrawContainer();
|
||||
|
||||
// if currentType is not in options, close popup
|
||||
if (!options.some((o) => o.type === currentType) && isPopupOpen) {
|
||||
@@ -90,6 +93,7 @@ export const ToolPopover = ({
|
||||
<Popover.Content
|
||||
className="tool-popover-content"
|
||||
sideOffset={SIDE_OFFSET}
|
||||
collisionBoundary={container ?? undefined}
|
||||
>
|
||||
{options.map(({ type, icon, title }) => (
|
||||
<ToolButton
|
||||
|
||||
Reference in New Issue
Block a user