1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-07 21:47:02 +09:00

JS-7115: fix

This commit is contained in:
Andrew Simachev 2025-05-23 10:29:45 +02:00
parent 89711246e3
commit aa3707558d
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF

View file

@ -57,16 +57,16 @@ const Graph = observer(forwardRef<GraphRefProps, Props>(({
const win = $(window);
unbind();
win.on('updateGraphSettings.graph', () => updateSettings());
win.on('updateGraphRoot.graph', (e: any, data: any) => setRootId(data.id));
win.on('removeGraphNode.graph', (e: any, data: any) => send('onRemoveNode', { ids: U.Common.objectCopy(data.ids) }));
win.on(`keydown.graph`, e => onKeyDown(e));
win.on(`updateGraphSettings.${id}`, () => updateSettings());
win.on(`updateGraphRoot.${id}`, (e: any, data: any) => setRootId(data.id));
win.on(`removeGraphNode.${id}`, (e: any, data: any) => send('onRemoveNode', { ids: U.Common.objectCopy(data.ids) }));
win.on(`keydown.${id}`, e => onKeyDown(e));
};
const unbind = () => {
const events = [ 'updateGraphSettings', 'updateGraphRoot', 'removeGraphNode', 'keydown' ];
$(window).off(events.map(it => `${it}.graph`).join(' '));
$(window).off(events.map(it => `${it}.${id}`).join(' '));
};
const getTouchDistance = (touches: { clientX: number, clientY: number }[]): number => {