-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Introducing 3D annotations #1638
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
Changes from 3 commits
aa58118
8b8bdea
1a8f1ed
f4b14e6
4dc16e4
8e6ab7d
c5f6eb2
b7ab656
fbdcee8
981b1a1
94b940d
8ac2551
ababc49
7cfba36
8f9e370
1bbabad
9520943
f61cd4d
8cb10c1
a31549d
bd9c867
21c8cc6
adfc305
c084da0
ef985cf
0b4214f
8b8a088
1d5606a
46ab63d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,8 +101,7 @@ function drawOne(gd, index) { | |
|
||
// another group for text+background so that they can rotate together | ||
var annTextGroup = annGroup.append('g') | ||
.classed('annotation-text-g', true) | ||
.attr('data-index', String(index)); | ||
.classed('annotation-text-g', true); | ||
|
||
var annTextGroupInner = annTextGroup.append('g') | ||
.style('pointer-events', options.captureevents ? 'all' : null) | ||
|
@@ -169,7 +168,6 @@ function drawOne(gd, index) { | |
var font = options.font; | ||
|
||
var annText = annTextGroupInner.append('text') | ||
.classed('annotation', true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you've hit on a flaw in how github displays comments... I'm reading:
but I'm looking at a31549d which came after ababc49 and rereverts the change originally made in 1a8f1ed 💫 Anyway, totally approve of this change. My best guess is these got the same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In brief, as of a31549d, the annotations |
||
.attr('data-unformatted', options.text) | ||
.text(options.text); | ||
|
||
|
@@ -225,10 +223,13 @@ function drawOne(gd, index) { | |
} | ||
|
||
var annotationIsOffscreen = false; | ||
['x', 'y'].forEach(function(axLetter) { | ||
var axRef = options[axLetter + 'ref'] || axLetter, | ||
var letters = ['x', 'y']; | ||
|
||
for(var i = 0; i < letters.length; i++) { | ||
var axLetter = letters[i], | ||
axRef = options[axLetter + 'ref'] || axLetter, | ||
tailRef = options['a' + axLetter + 'ref'], | ||
ax = Axes.getFromId(gd, axRef), | ||
ax = {x: xa, y: ya}[axLetter], | ||
dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, | ||
// note that these two can be either positive or negative | ||
annSizeFromWidth = outerWidth * Math.cos(dimAngle), | ||
|
@@ -350,7 +351,7 @@ function drawOne(gd, index) { | |
// size/shift are used during dragging | ||
options['_' + axLetter + 'size'] = annSize; | ||
options['_' + axLetter + 'shift'] = textShift; | ||
}); | ||
} | ||
|
||
if(annotationIsOffscreen) { | ||
annTextGroupInner.remove(); | ||
|
@@ -471,8 +472,7 @@ function drawOne(gd, index) { | |
|
||
var arrowGroup = annGroup.append('g') | ||
.style({opacity: Color.opacity(arrowColor)}) | ||
.classed('annotation-arrow-g', true) | ||
.attr('data-index', String(index)); | ||
.classed('annotation-arrow-g', true); | ||
|
||
var arrow = arrowGroup.append('path') | ||
.attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) | ||
|
@@ -492,10 +492,8 @@ function drawOne(gd, index) { | |
arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; | ||
} | ||
var arrowDrag = arrowGroup.append('path') | ||
.classed('annotation', true) | ||
.classed('anndrag', true) | ||
.attr({ | ||
'data-index': String(index), | ||
d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), | ||
transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' | ||
}) | ||
|
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.
👍 another relic 🔪