•   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,
Kyle

  • 2 comments

  •   •   over 8 years ago

    Hello,

    1. SPen_Example_Animation uses saveSAMMFile and loadSAMMFile functions for saving and loading the canvas. It keeps drawing history by default. If you want to save pictures without keeping the drawing history you can use getBitmap funciton of SCanvasview, save only bitmap and then load it from file. You will get only the picture, without drawing history.

    2. The undo/redo operations on SCanvasView work with all types of events: drawing, ereasing, adding pictures, adding text, etc. In SPen_Example_Animation application you can add text or picture and then undo it.

    Thanks,
    @samsungJohn

  •   •   over 8 years ago

    Thank you...our device is currently being used to work on the video, but I'm going to test out this functionality as soon as its returned.

    Kyle

Comments are closed.