1- var $ = require ( 'jquery' ) ;
21var geo_event = require ( '../event' ) ;
32var geo_action = require ( '../action' ) ;
43var transform = require ( '../transform' ) ;
@@ -101,7 +100,7 @@ var annotation = function (type, args) {
101100 }
102101
103102 var m_this = this ,
104- m_options = $ . extend ( true , { } , this . constructor . defaults , args || { } ) ,
103+ m_options = util . deepMerge ( { } , this . constructor . defaults , args || { } ) ,
105104 m_id = m_options . annotationId ;
106105 delete m_options . annotationId ;
107106 if ( m_id === undefined || ( m_options . layer && m_options . layer . annotationById ( m_id ) ) ) {
@@ -526,14 +525,14 @@ var annotation = function (type, args) {
526525 var coordinatesSet ;
527526 if ( arg2 === undefined ) {
528527 coordinatesSet = arg1 [ m_this . _coordinateOption ] !== undefined ;
529- m_options = $ . extend ( true , m_options , arg1 ) ;
528+ m_options = util . deepMerge ( m_options , arg1 ) ;
530529 /* For style objects, re-extend them without recursion. This allows
531530 * setting colors without an opacity field, for instance. */
532531 [ 'style' , 'createStyle' , 'editStyle' , 'editHandleStyle' , 'labelStyle' ,
533532 'highlightStyle' , 'cursorStyle'
534533 ] . forEach ( function ( key ) {
535534 if ( arg1 [ key ] !== undefined ) {
536- $ . extend ( m_options [ key ] , arg1 [ key ] ) ;
535+ Object . assign ( m_options [ key ] , arg1 [ key ] ) ;
537536 }
538537 } ) ;
539538 } else {
@@ -596,7 +595,7 @@ var annotation = function (type, args) {
596595 m_options [ styleType ] = { } ;
597596 }
598597 if ( arg2 === undefined ) {
599- m_options [ styleType ] = $ . extend ( true , m_options [ styleType ] , arg1 ) ;
598+ m_options [ styleType ] = util . deepMerge ( m_options [ styleType ] , arg1 ) ;
600599 } else {
601600 m_options [ styleType ] [ arg1 ] = arg2 ;
602601 }
@@ -659,15 +658,15 @@ var annotation = function (type, args) {
659658 /* for some states, fall back to the general style if they don't specify a
660659 * value explicitly. */
661660 if ( state === annotationState . edit || state === annotationState . highlight ) {
662- return $ . extend ( { } , m_options . style , m_options [ state + 'Style' ] ) ;
661+ return Object . assign ( { } , m_options . style , m_options [ state + 'Style' ] ) ;
663662 }
664663 if ( state === annotationState . create ) {
665- return $ . extend ( { } , m_options . style , m_options . editStyle ,
666- m_options [ state + 'Style' ] ) ;
664+ return Object . assign ( { } , m_options . style , m_options . editStyle ,
665+ m_options [ state + 'Style' ] ) ;
667666 }
668667 if ( state === annotationState . cursor ) {
669- return $ . extend ( { } , m_options . style , m_options . editStyle ,
670- m_options . createStyle , m_options [ state + 'Style' ] ) ;
668+ return Object . assign ( { } , m_options . style , m_options . editStyle ,
669+ m_options . createStyle , m_options [ state + 'Style' ] ) ;
671670 }
672671 return m_options [ state + 'Style' ] || m_options . style || { } ;
673672 } ;
@@ -925,15 +924,15 @@ var annotation = function (type, args) {
925924 */
926925 this . _addEditHandles = function ( features , vertices , opts , isOpen ) {
927926 var editPoints ,
928- style = $ . extend ( { } , defaultEditHandleStyle , m_this . editHandleStyle ( ) ) ,
927+ style = Object . assign ( { } , defaultEditHandleStyle , m_this . editHandleStyle ( ) ) ,
929928 handles = util . ensureFunction ( style . handles ) ( ) || { } ,
930929 selected = (
931930 m_this . _editHandle && m_this . _editHandle . handle &&
932931 m_this . _editHandle . handle . selected ?
933932 m_this . _editHandle . handle : undefined ) ;
934933 /* opts specify which handles are allowed. They must be allowed by the
935934 * original opts object and by the editHandleStyle.handle object. */
936- opts = $ . extend ( { } , opts ) ;
935+ opts = Object . assign ( { } , opts ) ;
937936 Object . keys ( handles ) . forEach ( function ( key ) {
938937 if ( handles [ key ] === false ) {
939938 opts [ key ] = false ;
@@ -947,27 +946,27 @@ var annotation = function (type, args) {
947946 vertexList . forEach ( ( vert , vidx ) => {
948947 vert . forEach ( function ( pt , idx ) {
949948 if ( opts . vertex !== false ) {
950- editPoints . push ( $ . extend ( { } , pt , { type : 'vertex' , index : idx , vindex : vidx , style : style , editHandle : true } ) ) ;
949+ editPoints . push ( Object . assign ( { } , pt , { type : 'vertex' , index : idx , vindex : vidx , style : style , editHandle : true } ) ) ;
951950 }
952951 if ( opts . edge !== false && idx !== vert . length - 1 && ( pt . x !== vert [ idx + 1 ] . x || pt . y !== vert [ idx + 1 ] . y ) ) {
953- editPoints . push ( $ . extend ( {
952+ editPoints . push ( Object . assign ( {
954953 x : ( pt . x + vert [ idx + 1 ] . x ) / 2 ,
955954 y : ( pt . y + vert [ idx + 1 ] . y ) / 2
956955 } , { type : 'edge' , index : idx , vindex : vidx , style : style , editHandle : true } ) ) ;
957956 }
958957 if ( opts . edge !== false && ! isOpen && idx === vert . length - 1 && ( pt . x !== vert [ 0 ] . x || pt . y !== vert [ 0 ] . y ) ) {
959- editPoints . push ( $ . extend ( {
958+ editPoints . push ( Object . assign ( {
960959 x : ( pt . x + vert [ 0 ] . x ) / 2 ,
961960 y : ( pt . y + vert [ 0 ] . y ) / 2
962961 } , { type : 'edge' , index : idx , vindex : vidx , style : style , editHandle : true } ) ) ;
963962 }
964963 } ) ;
965964 } ) ;
966965 if ( opts . center !== false ) {
967- editPoints . push ( $ . extend ( { } , util . centerFromPerimeter ( m_this . _coordinates ( ) ) , { type : 'center' , style : style , editHandle : true } ) ) ;
966+ editPoints . push ( Object . assign ( { } , util . centerFromPerimeter ( m_this . _coordinates ( ) ) , { type : 'center' , style : style , editHandle : true } ) ) ;
968967 }
969968 if ( opts . rotate !== false ) {
970- editPoints . push ( $ . extend ( m_this . _rotateHandlePosition (
969+ editPoints . push ( Object . assign ( m_this . _rotateHandlePosition (
971970 style . rotateHandleOffset ,
972971 style . rotateHandleRotation + ( selected && selected . type === 'rotate' ? m_this . _editHandle . amountRotated : 0 )
973972 ) , { type : 'rotate' , style : style , editHandle : true } ) ) ;
@@ -976,7 +975,7 @@ var annotation = function (type, args) {
976975 }
977976 }
978977 if ( opts . resize !== false ) {
979- editPoints . push ( $ . extend ( m_this . _rotateHandlePosition (
978+ editPoints . push ( Object . assign ( m_this . _rotateHandlePosition (
980979 style . resizeHandleOffset ,
981980 style . resizeHandleRotation
982981 ) , { type : 'resize' , style : style , editHandle : true } ) ) ;
0 commit comments