Skip to content

Commit

Permalink
add config jump to newest frame (#615)
Browse files Browse the repository at this point in the history
* add `frame_update`

* update description
  • Loading branch information
PythonFZ authored Aug 14, 2024
1 parent cb1fcaf commit 8b8b002
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export default function App() {
setStep(parseInt(data) - 1);
// reset selected ids
setSelectedIds(new Set());
} else if (roomConfig.scene.frame_update) {
setStep(parseInt(data) - 1);
}
setLength(data);
});
Expand All @@ -166,7 +168,7 @@ export default function App() {
return () => {
socket.off("room:frames:refresh", onFramesRefresh);
};
}, [step]);
}, [step, roomConfig.scene]);

useEffect(() => {
function onConnect() {
Expand Down
5 changes: 5 additions & 0 deletions zndraw/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class Scene(BaseModel):
camera_far: float = Field(
1000, ge=1, le=10000, description="Camera far rendering plane"
)
frame_update: bool = Field(
True,
description="Jump to updated frames.",
)
# bonds: bool = Field(
# True,
# description="Show bonds.",
Expand Down Expand Up @@ -110,6 +114,7 @@ def get_updated_schema(cls) -> dict:
schema["properties"]["Animation Loop"]["format"] = "checkbox"
schema["properties"]["simulation_box"]["format"] = "checkbox"
schema["properties"]["vectorfield"]["format"] = "checkbox"
schema["properties"]["frame_update"]["format"] = "checkbox"
# schema["properties"]["resolution"]["format"] = "range"
# schema["properties"]["label_offset"]["format"] = "range"
schema["properties"]["particle_size"]["format"] = "range"
Expand Down

0 comments on commit 8b8b002

Please sign in to comment.