Hareeshchandera / jsplumb

Automatically exported from code.google.com/p/jsplumb
0 stars 0 forks source link

'absolute' overlay position #224

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently the location of an overlay can be set with a number between 0 and 1. 
(at least for the Arrow overlay : 
http://jsplumb.org/apidocs/files/jquery-jsPlumb-1-3-7-all-js.html#Overlays.Arrow
.Functions)

This works well for single connections, but when we have multiple connections 
who's are sharing the same endpoint, it looks a bit strange. This can be seen 
with the attached image.

My request: support a absolute position e.g.:

location: 20px //20px for the start of the connection
location: -20px //20px for the end of the connection

Dunno if this is difficult to implement. 

Original issue reported on code.google.com by j.verdur...@2bmore.nl on 12 Mar 2012 at 9:33

Attachments:

GoogleCodeExporter commented 8 years ago
i've been asked about this before.  we'd need to be clear on what "20px from 
the start of the connection" means.   is it travel along the path inscribed by 
the connector?

Original comment by simon.po...@gmail.com on 12 Mar 2012 at 9:54

GoogleCodeExporter commented 8 years ago
20px from the start is independent of the length of the connector. 

Original comment by j.verdur...@2bmore.nl on 12 Mar 2012 at 9:58

GoogleCodeExporter commented 8 years ago
but i agree that calculating "20px from the start of the connection" for a 
Bezier connector is difficult (and maybe not needed).

I just need a overlay which is on the same place on the connector, independent 
of the connector length. How the 20px is calculated, and if it's accurate, is 
not that important.

Original comment by j.verdur...@2bmore.nl on 12 Mar 2012 at 10:00

GoogleCodeExporter commented 8 years ago
Yes but is it 20px along the path inscribed by the connector. Or is it just 
20px away from the start of the lone. 

Original comment by simon.po...@gmail.com on 12 Mar 2012 at 10:01

GoogleCodeExporter commented 8 years ago
Dunno, I think the first. But is not that important as long as it is 
independent of the connector length. 

Original comment by j.verdur...@2bmore.nl on 12 Mar 2012 at 10:12

GoogleCodeExporter commented 8 years ago
It's the same for a car. The precise definition of a horsepower is not that 
important for a customer, only that we can compare it with other cars and that 
the scale is linear. The definition of one horsepower varies by country ;)

Original comment by j.verdur...@2bmore.nl on 12 Mar 2012 at 10:14

GoogleCodeExporter commented 8 years ago
Does it? I didn't know that. 

Yeah what I was getting at was the bezier and state machine connectors - not as 
straightforward as straight lines or flowchart. But jsBezier does have a 
'pointAlongPathFrom' function which can provide the number we need. 

I will see about getting this in to 1.3.8. It seems like a nice feature.

Original comment by simon.po...@gmail.com on 12 Mar 2012 at 10:32

GoogleCodeExporter commented 8 years ago
possible candidate for 1.3.10; wont make it into 1.3.9.

Original comment by simon.po...@gmail.com on 23 May 2012 at 10:23

GoogleCodeExporter commented 8 years ago
i've done the work for this now.  it works like this:

- values greater than 1 or less than 0 are treated as absolute values, in 
pixels, representing an amount of travel along the path inscribed by the 
connector. negative values define a distance from the target of the connection.

- values provided as strings (without 'px' or 'pt' or whatever, just numbers) 
are also treated as absolute values, in the same way. this pretty much just 
caters for the case, possibly rare, that a user wishes to specify '1' or '-1' 
pixels as an absolute offset.

- values between 0 and 1, inclusive, are still treated as a fraction of travel 
along the entire path inscribed by the connector.

Original comment by simon.po...@gmail.com on 22 Jun 2012 at 2:45