fix(draw): close #525
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
|
import { Vec } from '@tldraw/vec';
|
||||||
import { TldrawApp, TLDR } from '@toeverything/components/board-state';
|
import { TldrawApp, TLDR } from '@toeverything/components/board-state';
|
||||||
import { Popover, styled, Divider } from '@toeverything/components/ui';
|
import { Popover, styled, Divider } from '@toeverything/components/ui';
|
||||||
import { getAnchor, useConfig } from './utils';
|
import { getAnchor, useConfig } from './utils';
|
||||||
@@ -14,6 +15,9 @@ import { Lock, Unlock } from './LockOperation';
|
|||||||
export const CommandPanel: FC<{ app: TldrawApp }> = ({ app }) => {
|
export const CommandPanel: FC<{ app: TldrawApp }> = ({ app }) => {
|
||||||
const state = app.useStore();
|
const state = app.useStore();
|
||||||
const bounds = TLDR.get_selected_bounds(state);
|
const bounds = TLDR.get_selected_bounds(state);
|
||||||
|
const camera = app.useStore(
|
||||||
|
s => s.document.pageStates[s.appState.currentPageId].camera
|
||||||
|
);
|
||||||
const point = bounds
|
const point = bounds
|
||||||
? app.getScreenPoint([bounds.minX, bounds.minY])
|
? app.getScreenPoint([bounds.minX, bounds.minY])
|
||||||
: undefined;
|
: undefined;
|
||||||
@@ -21,8 +25,8 @@ export const CommandPanel: FC<{ app: TldrawApp }> = ({ app }) => {
|
|||||||
const anchor = getAnchor({
|
const anchor = getAnchor({
|
||||||
x: point?.[0] || 0,
|
x: point?.[0] || 0,
|
||||||
y: (point?.[1] || 0) + 40,
|
y: (point?.[1] || 0) + 40,
|
||||||
width: bounds?.width || 0,
|
width: bounds?.width ? bounds.width * camera.zoom : 0,
|
||||||
height: bounds?.height || 0,
|
height: bounds?.height ? bounds.height * camera.zoom : 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = useConfig(app);
|
const config = useConfig(app);
|
||||||
|
|||||||
Reference in New Issue
Block a user