1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-10 10:00:48 +09:00

JS-1306: onNewObject method in worker

This commit is contained in:
Mike Mhlv 2023-04-14 15:05:44 +01:00
parent 7b6b541c65
commit 26e9367f4f
No known key found for this signature in database
GPG key ID: 82F8AC181346CE7F
3 changed files with 12 additions and 3 deletions

View file

@ -677,6 +677,11 @@ onSetRootId = ({ rootId }) => {
redraw();
};
onNewObject = ({x, y}) => {
console.log('COORDS: ', x, y)
console.log('NODES: ', nodes)
};
restart = (alpha) => {
simulation.alphaTarget(alpha).restart();
};

View file

@ -327,7 +327,7 @@ const PageMainGraph = observer(class PageMainGraph extends React.Component<I.Pag
});
};
onContextSpaceClick (param: any) {
onContextSpaceClick (param: any, cb?: () => void) {
menuStore.open('select', {
...param,
data: {
@ -335,7 +335,9 @@ const PageMainGraph = observer(class PageMainGraph extends React.Component<I.Pag
onSelect: (event: any, item: any) => {
switch (item.id) {
case 'newObject': {
console.log('NEW OBJECT!')
if (cb) {
cb();
};
break;
};
};

View file

@ -14,7 +14,7 @@ interface Props {
data: any;
onClick?: (object: any) => void;
onContextMenu?: (id: string, param: any) => void;
onContextSpaceClick?: (param: any) => void;
onContextSpaceClick?: (param: any, cb?: () => void) => void;
onSelect?: (id: string, related?: string[]) => void;
};
@ -363,6 +363,8 @@ const Graph = observer(class Graph extends React.Component<Props> {
onContextSpaceClick({
...menuParam
}, () => {
this.send('onNewObject', { x: data.x, y: data.y });
});
break;
};