12
12
var Plotly = require ( '../../plotly' ) ;
13
13
var d3 = require ( 'd3' ) ;
14
14
var isNumeric = require ( 'fast-isnumeric' ) ;
15
+ var setCursor = require ( '../../lib/setcursor' ) ;
16
+ var dragElement = require ( '../dragelement' ) ;
15
17
16
18
var annotations = module . exports = { } ;
17
19
@@ -583,7 +585,7 @@ annotations.draw = function(gd, index, opt, value) {
583
585
annx0 ,
584
586
anny0 ;
585
587
586
- Plotly . Fx . dragElement ( {
588
+ dragElement . init ( {
587
589
element : arrowdrag . node ( ) ,
588
590
prepFn : function ( ) {
589
591
annx0 = Number ( ann . attr ( 'x' ) ) ;
@@ -641,7 +643,7 @@ annotations.draw = function(gd, index, opt, value) {
641
643
y0 ,
642
644
update ;
643
645
644
- Plotly . Fx . dragElement ( {
646
+ dragElement . init ( {
645
647
element : ann . node ( ) ,
646
648
prepFn : function ( ) {
647
649
x0 = Number ( ann . attr ( 'x' ) ) ;
@@ -662,7 +664,7 @@ annotations.draw = function(gd, index, opt, value) {
662
664
var widthFraction = options . _xsize / gs . w ,
663
665
xLeft = options . x + options . _xshift / gs . w - widthFraction / 2 ;
664
666
665
- update [ annbase + '.x' ] = Plotly . Fx . dragAlign ( xLeft + dx / gs . w ,
667
+ update [ annbase + '.x' ] = dragElement . align ( xLeft + dx / gs . w ,
666
668
widthFraction , 0 , 1 , options . xanchor ) ;
667
669
}
668
670
@@ -671,11 +673,11 @@ annotations.draw = function(gd, index, opt, value) {
671
673
var heightFraction = options . _ysize / gs . h ,
672
674
yBottom = options . y - options . _yshift / gs . h - heightFraction / 2 ;
673
675
674
- update [ annbase + '.y' ] = Plotly . Fx . dragAlign ( yBottom - dy / gs . h ,
676
+ update [ annbase + '.y' ] = dragElement . align ( yBottom - dy / gs . h ,
675
677
heightFraction , 0 , 1 , options . yanchor ) ;
676
678
}
677
679
if ( ! xa || ! ya ) {
678
- csr = Plotly . Fx . dragCursors (
680
+ csr = dragElement . cursor (
679
681
xa ? 0.5 : update [ annbase + '.x' ] ,
680
682
ya ? 0.5 : update [ annbase + '.y' ] ,
681
683
options . xanchor , options . yanchor
@@ -694,10 +696,10 @@ annotations.draw = function(gd, index, opt, value) {
694
696
x1 + ',' + y1 + ')'
695
697
} ) ;
696
698
697
- Plotly . Fx . setCursor ( ann , csr ) ;
699
+ setCursor ( ann , csr ) ;
698
700
} ,
699
701
doneFn : function ( dragged ) {
700
- Plotly . Fx . setCursor ( ann ) ;
702
+ setCursor ( ann ) ;
701
703
if ( dragged ) {
702
704
Plotly . relayout ( gd , update ) ;
703
705
var notesBox = document . querySelector ( '.js-notes-box-panel' ) ;
0 commit comments