Kyle Parker • over 8 years ago
History and SCanvasView
I have a couple questions regarding the history listener for the canvas.
1. This may be a simple question, but I've not been able to find a way to handle this scenario.
In my app, I'm trying to implement a check to that prompts the user to save the canvas in the event they tap the back button with unsaved changes. Originally I started with com.samsung.sdraw.CanvasView. With this canvasview, I could simply check the undo history in the OnHistoryChangeListener - if "undoable" and the user hadn't saved the canvas, in onDestory I would display an alert dialog to prompt the user.
However after looking at the SPen_Example_Animation project, with its ability to add SObjectImage, I switched it to use the com.samsung.spensdk.SCanvasView.
Now, when I save the canvas, return to the list and re-open it, the undo history from my previous edits to that canvas already exist - basically, there's a compiled history rather than a blank slate. "Undoable" in the OnHistoryChangeListener is always "true" in this scenario, and invalidates my save validation in onDestory.
Is there a better way to determine whether changes have been made to the canvas?
2. With the undo/redo history, it appears as though SObjectImage, changing the background and the textbox object are not included? Tapping the undo button does not remove these objects from the canvas (or change size, text, etc) - it appears to only handle pen and eraser events. Is this accurate? Is there a way to include these other objects in that history?
Thanks for any pointers,
Comments are closed.