mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-11 10:18:07 +09:00
small graph tweaks
This commit is contained in:
parent
2317bb8cc8
commit
befef263a1
2 changed files with 7 additions and 15 deletions
20
dist/workers/graph.js
vendored
20
dist/workers/graph.js
vendored
|
@ -99,7 +99,7 @@ init = (param) => {
|
|||
ctx.lineCap = 'round';
|
||||
ctx.fillStyle = data.colors.bg;
|
||||
|
||||
transform = d3.zoomIdentity.translate(0, 0).scale(1.5);
|
||||
transform = d3.zoomIdentity.translate(0, 0).scale(1);
|
||||
simulation = d3.forceSimulation(nodes);
|
||||
simulation.alpha(1);
|
||||
|
||||
|
@ -108,21 +108,13 @@ init = (param) => {
|
|||
simulation.on('tick', () => redraw());
|
||||
simulation.tick(100);
|
||||
|
||||
setTimeout(() => {
|
||||
root = getNodeById(rootId);
|
||||
root = getNodeById(rootId);
|
||||
|
||||
let x = width / 2;
|
||||
let y = height / 2;
|
||||
const x = root ? root.x : width / 2;
|
||||
const y = root ? root.y : height / 2;
|
||||
|
||||
if (root) {
|
||||
x = root.x;
|
||||
y = root.y;
|
||||
};
|
||||
|
||||
transform = Object.assign(transform, getCenter(x, y));
|
||||
send('onTransform', { ...transform });
|
||||
redraw();
|
||||
}, 100);
|
||||
transform = Object.assign(transform, getCenter(x, y));
|
||||
send('onTransform', { ...transform });
|
||||
};
|
||||
|
||||
initTheme = (theme) => {
|
||||
|
|
|
@ -139,7 +139,7 @@ const Graph = observer(class Graph extends React.Component<Props> {
|
|||
on('end', (e: any, d: any) => this.onDragEnd(e))
|
||||
)
|
||||
.call(this.zoom)
|
||||
.call(this.zoom.transform, d3.zoomIdentity.translate(0, 0).scale(1.5))
|
||||
.call(this.zoom.transform, d3.zoomIdentity.translate(0, 0).scale(1))
|
||||
.on('click', (e: any) => {
|
||||
const { local } = commonStore.graph;
|
||||
const [ x, y ] = d3.pointer(e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue