This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Client Side Cloning

Hi, is client side cloning available for the .NET AJAX CanvasViewer?

I'm trying to clone the current VObject without success. Running the following javascript method causes the CanvasViewer to become unresponsive.

                 function Clone() {
                     var canvasViewer = $find("<%= CanvasViewer1.ClientID %>");
                     var cv = canvasViewer.get_canvas();
                     var vo = cv.get_currentVObject();
                     if (vo == null) return;

                     cv.beginUpdate();
                     vo.Transform.Clone();
                     cv.endUpdate();
                 }


Any help with this would be appreciated!

Thanks,
Andy
Andrew,

Unfortunately your code will not work. You have used Transform.clone method, which copies object's transforms only.
In your case I would like to recommend you to use Serialize and Deserialize methods (server-side ones) to copy and paste VObject.
Thanks Dmitry,

I'll use the server side methods instead.
Dmitry.Obukhov
Andrew,

Unfortunately your code will not work. You have used Transform.clone method, which copies object's transforms only.
In your case I would like to recommend you to use Serialize and Deserialize methods (server-side ones) to copy and paste VObject.


Hi Dmitry,
Do you have some coded example on how to copy a layer through Serialization/ Deserialization?

Thanks,
Marc
Hello Mark,

This is very simple code snippet:

string ser = photoLabel.CanvasViewer.Canvas.Serialize();
photoLabel.CanvasViewer.Canvas.Clear();
photoLabel.CanvasViewer.Canvas.Deserialize(ser);