@@ -498,7 +498,7 @@ annotations.draw = function(gd, index, opt, value) {
498
498
499
499
var annX = Math . round ( annPosPx . x - outerwidth / 2 ) ,
500
500
annY = Math . round ( annPosPx . y - outerheight / 2 ) ;
501
- ann . attr ( 'transform' , 'translate(' + annX + ', ' + annY + ')' ) ;
501
+ ann . call ( Lib . setTranslate , annX , annY ) ;
502
502
503
503
var annbase = 'annotations[' + index + ']' ;
504
504
@@ -591,8 +591,10 @@ annotations.draw = function(gd, index, opt, value) {
591
591
dragElement . init ( {
592
592
element : arrowdrag . node ( ) ,
593
593
prepFn : function ( ) {
594
- annx0 = Number ( ann . attr ( 'x' ) ) ;
595
- anny0 = Number ( ann . attr ( 'y' ) ) ;
594
+ var pos = Lib . getTranslate ( ann ) ;
595
+
596
+ annx0 = pos . x ;
597
+ anny0 = pos . y ;
596
598
update = { } ;
597
599
if ( xa && xa . autorange ) {
598
600
update [ xa . _name + '.autorange' ] = true ;
@@ -607,7 +609,7 @@ annotations.draw = function(gd, index, opt, value) {
607
609
var annxy0 = applyTransform ( annx0 , anny0 ) ,
608
610
xcenter = annxy0 [ 0 ] + dx ,
609
611
ycenter = annxy0 [ 1 ] + dy ;
610
- ann . call ( Drawing . setPosition , xcenter , ycenter ) ;
612
+ ann . call ( Lib . setTranslate , xcenter , ycenter ) ;
611
613
612
614
update [ annbase + '.x' ] = xa ?
613
615
( options . x + dx / xa . _m ) :
@@ -648,12 +650,14 @@ annotations.draw = function(gd, index, opt, value) {
648
650
dragElement . init ( {
649
651
element : ann . node ( ) ,
650
652
prepFn : function ( ) {
651
- x0 = Number ( ann . attr ( 'x' ) ) ;
652
- y0 = Number ( ann . attr ( 'y' ) ) ;
653
+ var pos = Lib . getTranslate ( ann ) ;
654
+
655
+ x0 = pos . x ;
656
+ y0 = pos . y ;
653
657
update = { } ;
654
658
} ,
655
659
moveFn : function ( dx , dy ) {
656
- ann . call ( Drawing . setPosition , x0 + dx , y0 + dy ) ;
660
+ ann . call ( Lib . setTranslate , x0 + dx , y0 + dy ) ;
657
661
var csr = 'pointer' ;
658
662
if ( options . showarrow ) {
659
663
update [ annbase + '.ax' ] = options . ax + dx ;
@@ -679,7 +683,7 @@ annotations.draw = function(gd, index, opt, value) {
679
683
heightFraction , 0 , 1 , options . yanchor ) ;
680
684
}
681
685
if ( ! xa || ! ya ) {
682
- csr = dragElement . cursor (
686
+ csr = dragElement . getCursor (
683
687
xa ? 0.5 : update [ annbase + '.x' ] ,
684
688
ya ? 0.5 : update [ annbase + '.y' ] ,
685
689
options . xanchor , options . yanchor
@@ -691,7 +695,7 @@ annotations.draw = function(gd, index, opt, value) {
691
695
x1 = xy1 [ 0 ] + dx ,
692
696
y1 = xy1 [ 1 ] + dy ;
693
697
694
- ann . call ( Drawing . setPosition , x1 , y1 ) ;
698
+ ann . call ( Lib . setTranslate , x0 + dx , y0 + dy ) ;
695
699
696
700
anng . attr ( {
697
701
transform : 'rotate(' + textangle + ',' +
0 commit comments