File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ var annotationLayer = function (arg) {
9696 m_options ,
9797 m_mode = null ,
9898 m_annotations = [ ] ,
99+ m_annotationIds = { } ,
99100 m_features = [ ] ,
100101 m_labelFeature ,
101102 m_labelLayer ,
@@ -504,6 +505,7 @@ var annotationLayer = function (arg) {
504505 annotation : annotation
505506 } ) ;
506507 m_annotations . push ( annotation ) ;
508+ m_annotationIds [ annotation . id ( ) ] = annotation ;
507509 annotation . layer ( m_this ) ;
508510 var map = m_this . map ( ) ;
509511 gcs = ( gcs === null ? map . gcs ( ) : (
@@ -537,6 +539,9 @@ var annotationLayer = function (arg) {
537539 if ( annotation === m_this . currentAnnotation ) {
538540 m_this . currentAnnotation = null ;
539541 }
542+ if ( m_annotationIds [ annotation . id ( ) ] !== undefined ) {
543+ delete m_annotationIds [ annotation . id ( ) ] ;
544+ }
540545 annotation . _exit ( ) ;
541546 m_annotations . splice ( pos , 1 ) ;
542547 if ( update !== false ) {
@@ -597,12 +602,7 @@ var annotationLayer = function (arg) {
597602 if ( id !== undefined && id !== null ) {
598603 id = + id ; /* Cast to int */
599604 }
600- var annotations = m_annotations . filter ( function ( annotation ) {
601- return annotation . id ( ) === id ;
602- } ) ;
603- if ( annotations . length ) {
604- return annotations [ 0 ] ;
605- }
605+ return m_annotationIds [ id ] ;
606606 } ;
607607
608608 /* A list of special modes */
@@ -1434,6 +1434,7 @@ var annotationLayer = function (arg) {
14341434 // Call super class exit
14351435 s_exit . call ( m_this ) ;
14361436 m_annotations = [ ] ;
1437+ m_annotationIds = { } ;
14371438 m_features = [ ] ;
14381439 return m_this ;
14391440 } ;
You can’t perform that action at this time.
0 commit comments