mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-09-26 20:31:11 +08:00
feat(network): preserve pan and scale on data reload
This commit is contained in:
@@ -68,6 +68,8 @@
|
||||
network.storePositions();
|
||||
} else {
|
||||
const positions = network.getPositions();
|
||||
const viewState = network.getViewPosition();
|
||||
const scale = network.getScale();
|
||||
|
||||
network.setData(data);
|
||||
|
||||
@@ -76,6 +78,8 @@
|
||||
network.moveNode(nodeId, positions[nodeId].x, positions[nodeId].y);
|
||||
}
|
||||
}
|
||||
|
||||
network.moveTo({ position: viewState, scale: scale });
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user