1
0
Fork 0
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:
Andrew Simachev 2024-04-19 09:15:47 +02:00
parent 2317bb8cc8
commit befef263a1
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8
2 changed files with 7 additions and 15 deletions

20
dist/workers/graph.js vendored
View file

@ -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) => {

View file

@ -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);