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:
parent
7b6b541c65
commit
26e9367f4f
3 changed files with 12 additions and 3 deletions
5
dist/workers/graph.js
vendored
5
dist/workers/graph.js
vendored
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue