mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-16 02:35:13 +01:00
tool bar fixes: icon and width
This commit is contained in:
@@ -101,8 +101,6 @@ export const MobileToolBar = ({
|
|||||||
"arrow" | "line"
|
"arrow" | "line"
|
||||||
>("arrow");
|
>("arrow");
|
||||||
|
|
||||||
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
||||||
|
|
||||||
// keep lastActiveGenericShape in sync with active tool if user switches via other UI
|
// keep lastActiveGenericShape in sync with active tool if user switches via other UI
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@@ -143,8 +141,8 @@ export const MobileToolBar = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toolbarWidth =
|
const [toolbarWidth, setToolbarWidth] = useState(0);
|
||||||
toolbarRef.current?.getBoundingClientRect()?.width ?? 0 - 8;
|
|
||||||
const WIDTH = 36;
|
const WIDTH = 36;
|
||||||
const GAP = 4;
|
const GAP = 4;
|
||||||
|
|
||||||
@@ -164,6 +162,9 @@ export const MobileToolBar = ({
|
|||||||
"laser",
|
"laser",
|
||||||
"magicframe",
|
"magicframe",
|
||||||
].filter((tool) => {
|
].filter((tool) => {
|
||||||
|
if (showTextToolOutside && tool === "text") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (showImageToolOutside && tool === "image") {
|
if (showImageToolOutside && tool === "image") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -174,21 +175,30 @@ export const MobileToolBar = ({
|
|||||||
});
|
});
|
||||||
const extraToolSelected = extraTools.includes(activeTool.type);
|
const extraToolSelected = extraTools.includes(activeTool.type);
|
||||||
const extraIcon = extraToolSelected
|
const extraIcon = extraToolSelected
|
||||||
? activeTool.type === "frame"
|
? activeTool.type === "text"
|
||||||
|
? TextIcon
|
||||||
|
: activeTool.type === "image"
|
||||||
|
? ImageIcon
|
||||||
|
: activeTool.type === "frame"
|
||||||
? frameToolIcon
|
? frameToolIcon
|
||||||
: activeTool.type === "embeddable"
|
: activeTool.type === "embeddable"
|
||||||
? EmbedIcon
|
? EmbedIcon
|
||||||
: activeTool.type === "laser"
|
: activeTool.type === "laser"
|
||||||
? laserPointerToolIcon
|
? laserPointerToolIcon
|
||||||
: activeTool.type === "text"
|
|
||||||
? TextIcon
|
|
||||||
: activeTool.type === "magicframe"
|
: activeTool.type === "magicframe"
|
||||||
? MagicIcon
|
? MagicIcon
|
||||||
: extraToolsIcon
|
: extraToolsIcon
|
||||||
: extraToolsIcon;
|
: extraToolsIcon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mobile-toolbar" ref={toolbarRef}>
|
<div
|
||||||
|
className="mobile-toolbar"
|
||||||
|
ref={(div) => {
|
||||||
|
if (div) {
|
||||||
|
setToolbarWidth(div.getBoundingClientRect().width);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
{/* Hand Tool */}
|
{/* Hand Tool */}
|
||||||
<HandButton
|
<HandButton
|
||||||
checked={isHandToolActive(app.state)}
|
checked={isHandToolActive(app.state)}
|
||||||
|
|||||||
Reference in New Issue
Block a user