Node move event


Author
Message
Igor Yakubov
Igor Yakubov
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1

Is there is a way to receive event when the node is moving (like MouseMove event) ?

Also I need a way to know when some shape is move upon another shape (like drag and drop)?

Thanks.

 


Ivo Milanov
Ivo Milanov
Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)
Group: Forum Members
Posts: 35, Visits: 32
Hi Igor,

Although the NodeBoundsChanged event is not raised in the document for the shape being previewed, the same event NodeBoundsChanged is raised by the view event sink service when you drag the shape clone around. For speed optimizations you have to set the FireEvents property of the preview layer to true first.

Although the shape clone. which serves as preview is a different object than the shape being previewed, they will both have the same UniqueId. The following code captures the event and gets the original shape whose bounds are to be changed:

view.PreviewLayer.FireEvents = true;
view.EventSinkService.NodeBoundsChanged += new Nevron.Dom.NodeEventHandler(EventSinkService_NodeBoundsChanged);

void EventSinkService_NodeBoundsChanged(Nevron.Dom.NNodeEventArgs args)
{
NShape previewShape = args.Node as NShape;
if (previewShape == null)
return;

NShape orignalShape = (NShape)document.GetElementFromUniqueId(previewShape.UniqueId);
// previewShape.Bounds are the bounds of the preview
// orignalShape.Bounds are the current original shape bounds – they will be set to
// previewShape.Bounds once the user has finished moving the preview
}

Hope this helps – questions or comments – please feel free…

Best regards,
Ivo
Hamdy Ghanem
Hamdy Ghanem
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1
How can I get the rotate value
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search