aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx')
-rw-r--r--src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx b/src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx
index fce52ef4b..67872efc3 100644
--- a/src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx
+++ b/src/client/views/nodes/MapboxMapBox/MapboxContainer.tsx
@@ -9,7 +9,7 @@ import { emptyFunction } from '../../../../Utils';
import { Doc, DocListCast, Field, LinkedTo, Opt } from '../../../../fields/Doc';
import { DocCss, Highlight } from '../../../../fields/DocSymbols';
import { Id } from '../../../../fields/FieldSymbols';
-import { DocCast, NumCast, StrCast } from '../../../../fields/Types';
+import { DocCast, NumCast, StrCast, toList } from '../../../../fields/Types';
import { DocumentType } from '../../../documents/DocumentTypes';
import { DocUtils, Docs } from '../../../documents/Documents';
import { DocumentManager } from '../../../util/DocumentManager';
@@ -120,7 +120,7 @@ export class MapBoxContainer extends ViewBoxAnnotatableComponent<FieldViewProps>
*/
sidebarAddDocument = (docsIn: Doc | Doc[], sidebarKey?: string) => {
if (!this.layoutDoc._layout_showSidebar) this.toggleSidebar();
- const docs = docsIn instanceof Doc ? [docsIn] : docsIn;
+ const docs = toList(docsIn);
docs.forEach(doc => {
let existingPin = this.allPushpins.find(pin => pin.latitude === doc.latitude && pin.longitude === doc.longitude) ?? this.selectedPin;
if (doc.latitude !== undefined && doc.longitude !== undefined && !existingPin) {
@@ -142,14 +142,14 @@ export class MapBoxContainer extends ViewBoxAnnotatableComponent<FieldViewProps>
return this.addDocument(docs, sidebarKey); // add to sidebar list
};
- removeMapDocument = (doc: Doc | Doc[], annotationKey?: string) => {
- const docs = doc instanceof Doc ? [doc] : doc;
+ removeMapDocument = (docsIn: Doc | Doc[], annotationKey?: string) => {
+ const docs = toList(docsIn);
this.allAnnotations
.filter(anno => docs.includes(DocCast(anno.mapPin)))
.forEach(anno => {
anno.mapPin = undefined;
});
- return this.removeDocument(doc, annotationKey, undefined);
+ return this.removeDocument(docsIn, annotationKey, undefined);
};
/**