fix menus
This commit is contained in:
parent
4cc9346b83
commit
e3d87ea018
|
|
@ -24,6 +24,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import { ChatBox } from '@/shapes/ChatBoxShapeUtil';
|
import { ChatBox } from '@/shapes/ChatBoxShapeUtil';
|
||||||
import { components, uiOverrides } from '@/ui-overrides'
|
import { components, uiOverrides } from '@/ui-overrides'
|
||||||
import { useCameraControls } from '@/hooks/useCameraControls'
|
import { useCameraControls } from '@/hooks/useCameraControls'
|
||||||
|
import { zoomToSelection } from '../ui-overrides'
|
||||||
|
|
||||||
//const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev`
|
//const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev`
|
||||||
export const WORKER_URL = 'https://jeffemmett-canvas.jeffemmett.workers.dev';
|
export const WORKER_URL = 'https://jeffemmett-canvas.jeffemmett.workers.dev';
|
||||||
|
|
@ -93,7 +94,7 @@ export function Board() {
|
||||||
kbd: 'z',
|
kbd: 'z',
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
if (editor.getSelectedShapeIds().length > 0) {
|
if (editor.getSelectedShapeIds().length > 0) {
|
||||||
zoomToFrame(editor.getSelectedShapeIds()[0]);
|
zoomToSelection(editor);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
readonlyOk: true,
|
readonlyOk: true,
|
||||||
|
|
@ -103,7 +104,12 @@ export function Board() {
|
||||||
label: 'Copy Link to Current View',
|
label: 'Copy Link to Current View',
|
||||||
kbd: 'c',
|
kbd: 'c',
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
copyLocationLink();
|
const camera = editor.getCamera();
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
url.searchParams.set('x', camera.x.toString());
|
||||||
|
url.searchParams.set('y', camera.y.toString());
|
||||||
|
url.searchParams.set('zoom', camera.z.toString());
|
||||||
|
navigator.clipboard.writeText(url.toString());
|
||||||
},
|
},
|
||||||
readonlyOk: true,
|
readonlyOk: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ const copyFrameLink = async (editor: Editor, frameId: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const zoomToSelection = (editor: Editor) => {
|
export const zoomToSelection = (editor: Editor) => {
|
||||||
// Store camera position before zooming
|
// Store camera position before zooming
|
||||||
storeCameraPosition(editor);
|
storeCameraPosition(editor);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue