Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scene save right after creation #1014

Merged
merged 4 commits into from
Jan 13, 2025
Merged

Fix scene save right after creation #1014

merged 4 commits into from
Jan 13, 2025

Conversation

vincentfretin
Copy link
Collaborator

This closes #1013 fixing several issues: duplicate scene saved, title not saved, positions not saved, blank screenshot

@vincentfretin vincentfretin requested a review from kfarr January 11, 2025 17:21
@@ -2,8 +2,6 @@
import useStore from '../store.js';
var streetplanUtils = require('../streetplan/streetplan-utils.js');

const state = useStore.getState();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful useStore.getState() returns a snapshot of the state.

@@ -171,7 +189,9 @@ export async function saveScene(currentUser, doSaveAs) {
export async function saveSceneWithScreenshot(currentUser, doSaveAs) {
const currentSceneId = await saveScene(currentUser, doSaveAs);
if (currentSceneId) {
makeScreenshot();
// wait a bit for models to be loaded, may not be enough...
await new Promise((resolve) => setTimeout(resolve, 2000));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have any issue locally, but I added that to wait a bit for models to be all loaded before taking the screenshot.

@kfarr kfarr merged commit 2b225e5 into main Jan 13, 2025
1 check passed
@vincentfretin vincentfretin deleted the fix-save-after-creation branch January 13, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scenes autosaving from streetmix result in blank screenshot
2 participants