-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add attributes xshift, yshift to annotations #1590
Conversation
@@ -524,21 +532,17 @@ function drawOne(gd, index) { | |||
|
|||
update[annbase + '.x'] = xa ? | |||
xa.p2r(xa.r2p(options.x) + dx) : | |||
((headX + dx - gs.l) / gs.w); | |||
(options.x + (dx / gs.w)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simplification 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
motivated by the fact that the old way would have needed to explicitly account for shift - notice though in the showarrow: false
case I did need to just include shift, due to the auto-anchor business...
@@ -1127,7 +1132,7 @@ describe('annotation effects', function() { | |||
} | |||
|
|||
makePlot([ | |||
{x: 50, y: 50, text: 'hi', width: 50, ax: 0, ay: -40}, | |||
{x: 50, y: 50, text: 'hi', width: 50, ax: 0, ay: -40, xshift: -50, yshift: 50}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is editable: true
tested with xshift / yshift? It's a little hard to tell from the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, all the other tests above this in describe('annotation effects'
, to which I added xshift: 5, yshift: 5
, are editable and failed before I fixed dragging with shifts.
[0.97, 2.03], [0.97, 2.03], | ||
['2000-10-01 08:23:18.0583', '2001-06-05 19:20:23.301'], [-0.245, 4.245], | ||
[0.9, 2.1], [0.86, 2.14] | ||
[0.91, 2.09], [0.91, 2.09], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so these values changed because the annotations-autorange
mock changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so these values changed because the
annotations-autorange
mock changed?
correct. I guess that's a hazard of reusing mocks for both images and jasmine tests...
All right. Nicely done 💃 |
Adds two new attributes to annotations,
xshift
andyshift
.Originally I thought I'd accomplish this by just allowing
standoff
to be a 2-vector, but I decided against this for a few reasons:ax
anday
standoff