1212var Plotly = require ( '../../plotly' ) ;
1313var d3 = require ( 'd3' ) ;
1414var isNumeric = require ( 'fast-isnumeric' ) ;
15+ var setCursor = require ( '../../lib/setcursor' ) ;
16+ var dragElement = require ( '../dragelement' ) ;
1517
1618var annotations = module . exports = { } ;
1719
@@ -583,7 +585,7 @@ annotations.draw = function(gd, index, opt, value) {
583585 annx0 ,
584586 anny0 ;
585587
586- Plotly . Fx . dragElement ( {
588+ dragElement . init ( {
587589 element : arrowdrag . node ( ) ,
588590 prepFn : function ( ) {
589591 annx0 = Number ( ann . attr ( 'x' ) ) ;
@@ -641,7 +643,7 @@ annotations.draw = function(gd, index, opt, value) {
641643 y0 ,
642644 update ;
643645
644- Plotly . Fx . dragElement ( {
646+ dragElement . init ( {
645647 element : ann . node ( ) ,
646648 prepFn : function ( ) {
647649 x0 = Number ( ann . attr ( 'x' ) ) ;
@@ -662,7 +664,7 @@ annotations.draw = function(gd, index, opt, value) {
662664 var widthFraction = options . _xsize / gs . w ,
663665 xLeft = options . x + options . _xshift / gs . w - widthFraction / 2 ;
664666
665- update [ annbase + '.x' ] = Plotly . Fx . dragAlign ( xLeft + dx / gs . w ,
667+ update [ annbase + '.x' ] = dragElement . align ( xLeft + dx / gs . w ,
666668 widthFraction , 0 , 1 , options . xanchor ) ;
667669 }
668670
@@ -671,11 +673,11 @@ annotations.draw = function(gd, index, opt, value) {
671673 var heightFraction = options . _ysize / gs . h ,
672674 yBottom = options . y - options . _yshift / gs . h - heightFraction / 2 ;
673675
674- update [ annbase + '.y' ] = Plotly . Fx . dragAlign ( yBottom - dy / gs . h ,
676+ update [ annbase + '.y' ] = dragElement . align ( yBottom - dy / gs . h ,
675677 heightFraction , 0 , 1 , options . yanchor ) ;
676678 }
677679 if ( ! xa || ! ya ) {
678- csr = Plotly . Fx . dragCursors (
680+ csr = dragElement . cursor (
679681 xa ? 0.5 : update [ annbase + '.x' ] ,
680682 ya ? 0.5 : update [ annbase + '.y' ] ,
681683 options . xanchor , options . yanchor
@@ -694,10 +696,10 @@ annotations.draw = function(gd, index, opt, value) {
694696 x1 + ',' + y1 + ')'
695697 } ) ;
696698
697- Plotly . Fx . setCursor ( ann , csr ) ;
699+ setCursor ( ann , csr ) ;
698700 } ,
699701 doneFn : function ( dragged ) {
700- Plotly . Fx . setCursor ( ann ) ;
702+ setCursor ( ann ) ;
701703 if ( dragged ) {
702704 Plotly . relayout ( gd , update ) ;
703705 var notesBox = document . querySelector ( '.js-notes-box-panel' ) ;
0 commit comments