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

Shapes not added to Decoded Drawing #27

Closed
eimlaymaire opened this issue Jul 1, 2019 · 4 comments
Closed

Shapes not added to Decoded Drawing #27

eimlaymaire opened this issue Jul 1, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@eimlaymaire
Copy link

eimlaymaire commented Jul 1, 2019

Drawing (only tested pen strokes) on a decoded drawing does not add shapes to the shapes array of that drawing. The new shapes still appear on the drawing, but since they're not added to the array they're not encoded if you want to save the drawing.

Edit: Never mind, they are being added to the drawing. But somehow, new shapes on a decoded drawing aren't being properly encoded.

@eimlaymaire
Copy link
Author

eimlaymaire commented Jul 2, 2019

Update: So it looks like when you draw on a decoded drawing, the append(shape:) method gets called in Drawing, but the new shape doesn't appear in the drawing's shapes array. I haven't been able to figure out why, so instead i just made a hacky fix.

If anyone's having the same problem, here's what I did to temporarily solve it: Overlay 2 drawsana views, decode your saved drawing into the background drawsana view, and let the user interact with the foreground one. Then, when you want to save your edits, merge the shapes of the 2 drawsana view drawings into a new Drawing, and encode.

@stevelandeyasana
Copy link
Collaborator

Thanks for taking the time to report and investigate this issue. Serialization isn't well-tested and I'm sorry you ran into a bug. As you can probably tell, time to work on this project is short and I hope to be able to give it a deeper look soon.

@stevelandeyasana stevelandeyasana added the bug Something isn't working label Jul 2, 2019
@stevelandeyasana
Copy link
Collaborator

I have another possibility for the root cause of this bug. Could it be that you're hanging onto the old Drawing instance somewhere? I just noticed that for example the active tool isn't informed if the Drawing instance changes.

@stevelandeyasana
Copy link
Collaborator

There was a bug in the library where the drawingOperationStack would never be updated with the new Drawing instance. That would probably cause the symptoms you described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants