Profile Picture

where to find the origin location

Posted By Leon Kusnezow 14 Years Ago
Author
Message
Leon Kusnezow
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 8, Visits: 1

Hi,

I use the .EventSinkService.NodeBoundsChanged event to check the place for the new position during dragging a shape.

So far it works fine. It also makes a hittest with other shapes and there I'm having trouble to find out the START-position of the dragged shape, if I want let the shape bounds back to the origin position.

For example:

I drag a shape -> the preview-shape shows me a new position:

a) if the place is free of other elements is that the new position for the shape. (works fine)

b) if the preview-shape hits an other element than jump back to the origin position. (how to find this position?)

You know this effect also from windows, if you drag a file in an unacceptable location the file stay on the origin postion.

 

I tried this in the eventfunction "Dim draggedshape As Nevron.Diagram.NShape = CType(args.Node, Nevron.Diagram.NShape)" but the location of the node is of course the current position and not the position where I started to drag the shape. 

I search something like DraggedShape.Startdragpostition or shape.position_befor_bouncing

Thanks in advance,

Leon



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi,

you can use a standard programming technique - remember the position of the mouse when the drag starts (for example in the NodeMouseDown event handler) and then place the shape there when needed.



Best Regards,
Nevron Support Team



Leon Kusnezow
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 8, Visits: 1
Thank you for your answer.

For this reason there is a problem.
My shapes are rectangular and the position of the mouse is up to 99% never that location of the rectangle.location. The x and y coordinates are defined in the up-left-corner of a rectangle. The user can select and start the drag on every possible place during a shape. So this ist not the location i am looking for.


I could equal the positions of the shapes after this event with the positions before this event -> to find out the origin Position of the dragged shape.

But maybe somebody see a better possibility for this case?

Best Regards
Leon






Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi,

you can use the ScenePoint property of the mouse event arguments to get the actual location (in scene coordinates) the user has clicked on.



Best Regards,
Nevron Support Team



Leon Kusnezow
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 8, Visits: 1

Hi thanks, i solved it now with the following code:

Private Sub EventSinkService_NodeMouseDown(ByVal args As Nevron.Diagram.NNodeMouseEventArgs)

...

Dim node As INNode = args.Node

Dim shape As NShape = TryCast(node, NShape)

...

origin_location_dragged_shape = shape.Location

...

end sub

 

 





Similar Topics


Reading This Topic