@abi-software/scaffoldvuer 1.6.0-beta.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scaffoldvuer.js +1884 -1869
- package/dist/scaffoldvuer.umd.cjs +3 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +1 -1
- package/src/components/ScaffoldTreeControls.vue +6 -0
- package/src/components/ScaffoldVuer.vue +96 -47
- package/src/scripts/Search.js +59 -70
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"*.js"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@abi-software/map-utilities": "^1.2.0
|
|
44
|
+
"@abi-software/map-utilities": "^1.2.0",
|
|
45
45
|
"@abi-software/sparc-annotation": "^0.3.1",
|
|
46
46
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
47
47
|
"@element-plus/icons-vue": "^2.3.1",
|
package/src/App.vue
CHANGED
|
@@ -142,6 +142,12 @@ export default {
|
|
|
142
142
|
isRegion: true,
|
|
143
143
|
};
|
|
144
144
|
this.addTreeItem(data.children, childRegionItem, region);
|
|
145
|
+
//Special case for helper region
|
|
146
|
+
if (path === "/_helper") {
|
|
147
|
+
this.$nextTick(() => {
|
|
148
|
+
this.$refs.treeControls.$refs.regionTree.setChecked(childRegionItem.id, false);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
145
151
|
}
|
|
146
152
|
_paths.shift();
|
|
147
153
|
return this.findOrCreateRegion(childRegionItem, _paths, path);
|
|
@@ -823,6 +823,11 @@ export default {
|
|
|
823
823
|
centre: [0, 0, 0],
|
|
824
824
|
size:[1, 1, 1],
|
|
825
825
|
},
|
|
826
|
+
lastSelected: markRaw({
|
|
827
|
+
region: "",
|
|
828
|
+
group: "",
|
|
829
|
+
isSearch: false,
|
|
830
|
+
})
|
|
826
831
|
};
|
|
827
832
|
},
|
|
828
833
|
watch: {
|
|
@@ -1327,12 +1332,13 @@ export default {
|
|
|
1327
1332
|
toggleDrawing: function (type, icon) {
|
|
1328
1333
|
this.createData.toBeDeleted = false;
|
|
1329
1334
|
if (type === 'mode') {
|
|
1335
|
+
this.cancelCreate()
|
|
1330
1336
|
this.activeDrawMode = icon;
|
|
1331
1337
|
this.createData.shape = '';
|
|
1332
1338
|
this.$module.selectObjectOnPick = true;
|
|
1333
1339
|
} else if (type === 'tool') {
|
|
1334
1340
|
this.activeDrawTool = icon;
|
|
1335
|
-
this.createData.shape = this.activeDrawTool;
|
|
1341
|
+
this.createData.shape = this.activeDrawTool ? this.activeDrawTool : '';
|
|
1336
1342
|
this.$module.selectObjectOnPick = false;
|
|
1337
1343
|
}
|
|
1338
1344
|
},
|
|
@@ -1538,6 +1544,16 @@ export default {
|
|
|
1538
1544
|
});
|
|
1539
1545
|
zincObjects = event.zincObjects;
|
|
1540
1546
|
}
|
|
1547
|
+
let id = undefined;
|
|
1548
|
+
let regionPath = undefined;
|
|
1549
|
+
if (event.identifiers.length > 0 && event.identifiers[0]) {
|
|
1550
|
+
id = event.identifiers[0].data.id
|
|
1551
|
+
? event.identifiers[0].data.id
|
|
1552
|
+
: event.identifiers[0].data.group;
|
|
1553
|
+
if (event.identifiers[0].data.region) {
|
|
1554
|
+
regionPath = event.identifiers[0].data.region;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1541
1557
|
/*
|
|
1542
1558
|
* Event Type 1: Selected
|
|
1543
1559
|
* Event Type 2: Highlighted
|
|
@@ -1545,11 +1561,12 @@ export default {
|
|
|
1545
1561
|
*/
|
|
1546
1562
|
if (event.eventType == 1) {
|
|
1547
1563
|
if (this.viewingMode === 'Annotation') {
|
|
1564
|
+
this.tData.label = id;
|
|
1565
|
+
this.tData.region = regionPath;
|
|
1548
1566
|
this.activateAnnotationMode(names, event);
|
|
1549
1567
|
} else {
|
|
1550
1568
|
if (this.$refs.scaffoldTreeControls) {
|
|
1551
1569
|
if (names.length > 0) {
|
|
1552
|
-
//this.$refs.scaffoldTreeControls.changeActiveByNames(names, region, false);
|
|
1553
1570
|
this.$refs.scaffoldTreeControls.updateActiveUI(zincObjects);
|
|
1554
1571
|
this.updatePrimitiveControls(zincObjects);
|
|
1555
1572
|
} else {
|
|
@@ -1557,6 +1574,17 @@ export default {
|
|
|
1557
1574
|
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1558
1575
|
}
|
|
1559
1576
|
}
|
|
1577
|
+
//Store the following for state saving. Search will handle the case with more than 1
|
|
1578
|
+
//identifiers.
|
|
1579
|
+
if (event.identifiers.length === 1) {
|
|
1580
|
+
this.lastSelected.isSearch = false;
|
|
1581
|
+
this.lastSelected.region = regionPath;
|
|
1582
|
+
this.lastSelected.group = event.identifiers[0].data.group;
|
|
1583
|
+
} else if (event.identifiers.length === 0) {
|
|
1584
|
+
this.lastSelected.isSearch = false;
|
|
1585
|
+
this.lastSelected.region = "";
|
|
1586
|
+
this.lastSelected.group = "";
|
|
1587
|
+
}
|
|
1560
1588
|
/**
|
|
1561
1589
|
* Emit when an object is selected
|
|
1562
1590
|
* @arg {Object} "Identifier of selected objects"
|
|
@@ -1566,29 +1594,21 @@ export default {
|
|
|
1566
1594
|
} else if (event.eventType == 2) {
|
|
1567
1595
|
if (this.selectedObjects.length === 0) {
|
|
1568
1596
|
this.hideRegionTooltip();
|
|
1569
|
-
// const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
1570
1597
|
if (this.$refs.scaffoldTreeControls) {
|
|
1571
1598
|
if (names.length > 0) {
|
|
1572
|
-
//this.$refs.scaffoldTreeControls.changeHoverByNames(names, region, false);
|
|
1573
1599
|
this.$refs.scaffoldTreeControls.updateHoverUI(zincObjects);
|
|
1574
1600
|
} else {
|
|
1575
1601
|
this.$refs.scaffoldTreeControls.removeHover(true);
|
|
1576
1602
|
}
|
|
1577
1603
|
}
|
|
1578
1604
|
if (event.identifiers.length > 0 && event.identifiers[0]) {
|
|
1579
|
-
let id = event.identifiers[0].data.id
|
|
1580
|
-
? event.identifiers[0].data.id
|
|
1581
|
-
: event.identifiers[0].data.group;
|
|
1582
1605
|
if (event.identifiers[0].coords) {
|
|
1583
1606
|
this.tData.active = false;
|
|
1584
|
-
this.
|
|
1585
|
-
|
|
1586
|
-
if (event.identifiers[0].data.region) {
|
|
1587
|
-
this.tData.region = event.identifiers[0].data.region;
|
|
1588
|
-
}
|
|
1589
|
-
else {
|
|
1590
|
-
this.tData.region = undefined;
|
|
1607
|
+
if (!this.viewingMode !== "Annotation" || !this.annotationSidebar) {
|
|
1608
|
+
this.tData.visible = true;
|
|
1591
1609
|
}
|
|
1610
|
+
this.tData.label = id;
|
|
1611
|
+
this.tData.region = regionPath;
|
|
1592
1612
|
this.tData.x = event.identifiers[0].coords.x;
|
|
1593
1613
|
this.tData.y = event.identifiers[0].coords.y;
|
|
1594
1614
|
this.createEditTemporaryLines(event.identifiers);
|
|
@@ -1931,7 +1951,6 @@ export default {
|
|
|
1931
1951
|
liveUpdates
|
|
1932
1952
|
);
|
|
1933
1953
|
} else {
|
|
1934
|
-
this.tData.visible = false;
|
|
1935
1954
|
const region = this.tData.region ? this.tData.region +"/" : "";
|
|
1936
1955
|
const annotationEntry = {
|
|
1937
1956
|
"featureId": region + this.tData.label,
|
|
@@ -1959,7 +1978,7 @@ export default {
|
|
|
1959
1978
|
changeViewingMode: function (modeName) {
|
|
1960
1979
|
if (this.$module) {
|
|
1961
1980
|
if (modeName) {
|
|
1962
|
-
this.viewingMode = modeName
|
|
1981
|
+
this.viewingMode = modeName;
|
|
1963
1982
|
}
|
|
1964
1983
|
if (this.viewingMode === "Annotation") {
|
|
1965
1984
|
let authenticated = false;
|
|
@@ -2088,9 +2107,15 @@ export default {
|
|
|
2088
2107
|
if (text === undefined || text === "" ||
|
|
2089
2108
|
((Array.isArray(text) && text.length === 0))
|
|
2090
2109
|
) {
|
|
2110
|
+
this.lastSelected.region = "";
|
|
2111
|
+
this.lastSelected.group = "";
|
|
2112
|
+
this.lastSelected.isSearch = true;
|
|
2091
2113
|
this.objectSelected([], true);
|
|
2092
2114
|
return false;
|
|
2093
2115
|
} else {
|
|
2116
|
+
this.lastSelected.region = "";
|
|
2117
|
+
this.lastSelected.group = text;
|
|
2118
|
+
this.lastSelected.isSearch = true;
|
|
2094
2119
|
const result = this.$_searchIndex.searchAndProcessResult(text);
|
|
2095
2120
|
const zincObjects = result.zincObjects;
|
|
2096
2121
|
if (zincObjects.length > 0) {
|
|
@@ -2150,26 +2175,42 @@ export default {
|
|
|
2150
2175
|
}
|
|
2151
2176
|
this.timeMax = this.$module.scene.getDuration();
|
|
2152
2177
|
},
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
if (options) {
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
this.$
|
|
2169
|
-
|
|
2170
|
-
|
|
2178
|
+
restoreSettings: function(options) {
|
|
2179
|
+
if (options) {
|
|
2180
|
+
if (options.viewport) {
|
|
2181
|
+
this.$module.scene
|
|
2182
|
+
.getZincCameraControls()
|
|
2183
|
+
.setCurrentCameraSettings(options.viewport);
|
|
2184
|
+
} else if (options.viewURL && options.viewURL !== "") {
|
|
2185
|
+
const url = new URL(options.viewURL, this.url);
|
|
2186
|
+
this.$module.scene.loadViewURL(url);
|
|
2187
|
+
} else if (options.region && options.region !== "") {
|
|
2188
|
+
this.viewRegion(options.region);
|
|
2189
|
+
}
|
|
2190
|
+
if (options.visibility) {
|
|
2191
|
+
// Some UIs may not be ready at this time.
|
|
2192
|
+
this.$nextTick(() => {
|
|
2193
|
+
this.$refs.scaffoldTreeControls.setState(options.visibility);
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
if (options.background) {
|
|
2197
|
+
this.backgroundChangeCallback(options.background);
|
|
2198
|
+
}
|
|
2199
|
+
if (options.viewingMode) {
|
|
2200
|
+
this.changeViewingMode(options.viewingMode);
|
|
2201
|
+
}
|
|
2202
|
+
const search = options.search;
|
|
2203
|
+
if (search && search.group) {
|
|
2204
|
+
if (search.isSearch) {
|
|
2205
|
+
this.search(search.group, true);
|
|
2206
|
+
} else {
|
|
2207
|
+
this.changeActiveByName(search.group, search.region, true);
|
|
2171
2208
|
}
|
|
2172
2209
|
}
|
|
2210
|
+
}
|
|
2211
|
+
},
|
|
2212
|
+
setURLFinishCallback: function (options) {
|
|
2213
|
+
return () => {
|
|
2173
2214
|
this.localAnnotationsList.length = 0;
|
|
2174
2215
|
this.updateSettingsfromScene();
|
|
2175
2216
|
this.$module.updateTime(0.01);
|
|
@@ -2191,6 +2232,7 @@ export default {
|
|
|
2191
2232
|
const {centre, size} = this.$module.getCentreAndSize();
|
|
2192
2233
|
this.boundingDims.centre = centre;
|
|
2193
2234
|
this.boundingDims.size = size;
|
|
2235
|
+
this.$nextTick(() => this.restoreSettings(options) );
|
|
2194
2236
|
this.isReady = true;
|
|
2195
2237
|
};
|
|
2196
2238
|
},
|
|
@@ -2206,6 +2248,8 @@ export default {
|
|
|
2206
2248
|
url: this._currentURL,
|
|
2207
2249
|
viewport: undefined,
|
|
2208
2250
|
visibility: undefined,
|
|
2251
|
+
background: this.currentBackground,
|
|
2252
|
+
viewingMode: this.viewingMode,
|
|
2209
2253
|
};
|
|
2210
2254
|
if (this.$refs.scaffoldTreeControls)
|
|
2211
2255
|
state.visibility = this.$refs.scaffoldTreeControls.getState();
|
|
@@ -2213,6 +2257,9 @@ export default {
|
|
|
2213
2257
|
let zincCameraControls = this.$module.scene.getZincCameraControls();
|
|
2214
2258
|
state.viewport = zincCameraControls.getCurrentViewport();
|
|
2215
2259
|
}
|
|
2260
|
+
if (this.lastSelected && this.lastSelected.group) {
|
|
2261
|
+
state.search = {...this.lastSelected};
|
|
2262
|
+
}
|
|
2216
2263
|
return state;
|
|
2217
2264
|
},
|
|
2218
2265
|
/**
|
|
@@ -2229,21 +2276,22 @@ export default {
|
|
|
2229
2276
|
fileFormat: state.fileFormat,
|
|
2230
2277
|
viewport: state.viewport,
|
|
2231
2278
|
visibility: state.visibility,
|
|
2279
|
+
background: state.background,
|
|
2280
|
+
viewingMode: this.viewingMode,
|
|
2281
|
+
search: state.search,
|
|
2232
2282
|
});
|
|
2233
2283
|
} else {
|
|
2234
|
-
if (state.viewport || state.visibility) {
|
|
2284
|
+
if (state.background || state.search || state.viewport || state.viewingMode || state.visibility) {
|
|
2235
2285
|
if (this.isReady && this.$module.scene) {
|
|
2236
|
-
|
|
2237
|
-
this.$module.scene
|
|
2238
|
-
.getZincCameraControls()
|
|
2239
|
-
.setCurrentCameraSettings(state.viewport);
|
|
2240
|
-
if (state.visibility)
|
|
2241
|
-
this.$refs.scaffoldTreeControls.setState(state.visibility);
|
|
2286
|
+
this.restoreSettings(state);
|
|
2242
2287
|
} else {
|
|
2243
2288
|
this.$module.setFinishDownloadCallback(
|
|
2244
2289
|
this.setURLFinishCallback({
|
|
2290
|
+
background: state.background,
|
|
2291
|
+
viewingMode: state.viewingMode,
|
|
2245
2292
|
viewport: state.viewport,
|
|
2246
2293
|
visibility: state.visibility,
|
|
2294
|
+
search: state.search,
|
|
2247
2295
|
})
|
|
2248
2296
|
);
|
|
2249
2297
|
}
|
|
@@ -2300,6 +2348,7 @@ export default {
|
|
|
2300
2348
|
});
|
|
2301
2349
|
}
|
|
2302
2350
|
},
|
|
2351
|
+
|
|
2303
2352
|
/**
|
|
2304
2353
|
* Function used for reading in new scaffold metadata and a custom
|
|
2305
2354
|
* viewport. This function will ignore the state prop and
|
|
@@ -2311,10 +2360,7 @@ export default {
|
|
|
2311
2360
|
*/
|
|
2312
2361
|
setURLAndState: function (newValue, state) {
|
|
2313
2362
|
if (newValue != this._currentURL) {
|
|
2314
|
-
if (state
|
|
2315
|
-
let viewport = state && state.viewport ? state.viewport : undefined;
|
|
2316
|
-
let visibility =
|
|
2317
|
-
state && state.visibility ? state.visibility : undefined;
|
|
2363
|
+
if (state?.format) this.fileFormat = state.format;
|
|
2318
2364
|
this._currentURL = newValue;
|
|
2319
2365
|
if (this.$refs.scaffoldTreeControls) this.$refs.scaffoldTreeControls.clear();
|
|
2320
2366
|
this.loading = true;
|
|
@@ -2324,10 +2370,13 @@ export default {
|
|
|
2324
2370
|
this.hideRegionTooltip();
|
|
2325
2371
|
this.$module.setFinishDownloadCallback(
|
|
2326
2372
|
this.setURLFinishCallback({
|
|
2327
|
-
|
|
2373
|
+
background: state?.background,
|
|
2328
2374
|
region: this.region,
|
|
2375
|
+
search: state?.search,
|
|
2376
|
+
viewingMode: state?.viewingMode,
|
|
2329
2377
|
viewURL: this.viewURL,
|
|
2330
|
-
|
|
2378
|
+
viewport: state?.viewport,
|
|
2379
|
+
visibility: state?.visibility,
|
|
2331
2380
|
})
|
|
2332
2381
|
);
|
|
2333
2382
|
if (this.fileFormat === "gltf") {
|
package/src/scripts/Search.js
CHANGED
|
@@ -44,60 +44,47 @@ export class SearchIndex
|
|
|
44
44
|
this._searchEngine = new MiniSearch({
|
|
45
45
|
fields: ['path', 'name'],
|
|
46
46
|
storeFields: ['path'],
|
|
47
|
-
tokenize: (string, _fieldName) => string.split(
|
|
47
|
+
tokenize: (string, _fieldName) => string.split(/[\s/]+/), // indexing tokenizer
|
|
48
48
|
});
|
|
49
|
-
this.
|
|
50
|
-
this.zincObjects = [];
|
|
51
|
-
this.regions = [];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
indexMetadata(featureId, metadata)
|
|
55
|
-
//================================
|
|
56
|
-
{
|
|
57
|
-
const textSeen = [];
|
|
58
|
-
for (const prop of indexedProperties) {
|
|
59
|
-
if (prop in metadata) {
|
|
60
|
-
const text = metadata[prop];
|
|
61
|
-
if (!textSeen.includes(text)) {
|
|
62
|
-
this.addTerm_(featureId, text);
|
|
63
|
-
textSeen.push(text);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
49
|
+
this.idMaps = {};
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
addZincObject(zincObject, id)
|
|
70
53
|
//=======================
|
|
71
54
|
{
|
|
72
55
|
const path = zincObject.getRegion().getFullPath();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
let groupName = zincObject.groupName;
|
|
57
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
58
|
+
groupName = groupName.replaceAll('"', '');
|
|
59
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
60
|
+
const item = { path: fullPath, name: groupName, id };
|
|
61
|
+
this._searchEngine.add(item);
|
|
62
|
+
this.idMaps[id] = { path: fullPath, zincObject };
|
|
77
63
|
}
|
|
78
64
|
|
|
79
65
|
removeZincObject(zincObject, id)
|
|
80
66
|
//=======================
|
|
81
67
|
{
|
|
82
68
|
const path = zincObject.getRegion().getFullPath();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
69
|
+
let groupName = zincObject.groupName;
|
|
70
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
71
|
+
groupName = groupName.replaceAll('"', '');
|
|
72
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
73
|
+
const item = { path: fullPath, name: groupName, id };
|
|
74
|
+
this._searchEngine.remove(item);
|
|
75
|
+
delete this.idMaps[id];
|
|
93
76
|
}
|
|
94
77
|
|
|
95
78
|
addRegion(region, id)
|
|
96
79
|
//=======================
|
|
97
80
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
let path = region.getFullPath();
|
|
82
|
+
let regionName = region.getName();
|
|
83
|
+
path = path.replaceAll('"', '');
|
|
84
|
+
regionName = regionName.replaceAll('"', '');
|
|
85
|
+
const item = { path, name: regionName, id };
|
|
86
|
+
this._searchEngine.add(item);
|
|
87
|
+
this.idMaps[id] = { path, zincObject: region };
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
clearResults()
|
|
@@ -110,17 +97,32 @@ export class SearchIndex
|
|
|
110
97
|
//=======================
|
|
111
98
|
{
|
|
112
99
|
this._searchEngine.removeAll();
|
|
113
|
-
this.zincObjects.length = 0;
|
|
114
|
-
this.regions.length = 0;
|
|
100
|
+
//this.zincObjects.length = 0;
|
|
101
|
+
//this.regions.length = 0;
|
|
102
|
+
this.idMaps = {};
|
|
115
103
|
}
|
|
116
104
|
|
|
117
|
-
auto_suggest(text)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
auto_suggest(text) {
|
|
106
|
+
let results = [];
|
|
107
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
108
|
+
text = text.replaceAll(text.slice(0, 1), '')
|
|
109
|
+
results = this._searchEngine.search(text, {prefix: true, combineWith: 'AND'})
|
|
110
|
+
} else if (text.length > 1) {
|
|
111
|
+
results = this._searchEngine.search(text, {prefix: true})
|
|
112
|
+
}
|
|
113
|
+
const items = [];
|
|
114
|
+
results.forEach(r => {
|
|
115
|
+
if (r.id in this.idMaps) {
|
|
116
|
+
items.push(this.idMaps[r.id].path);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const unique = [...new Set(items)];
|
|
120
|
+
const returned = [];
|
|
121
|
+
unique.forEach(u => returned.push({suggestion: '"' + u + '"'}));
|
|
122
|
+
return returned;
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
|
|
124
126
|
processResults(zincObjects, searchText) {
|
|
125
127
|
const result = {
|
|
126
128
|
regionPath: undefined,
|
|
@@ -145,11 +147,20 @@ export class SearchIndex
|
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
search(text) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
let results = undefined;
|
|
151
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
152
|
+
text = text.replaceAll(text.slice(0, 1), '')
|
|
153
|
+
results = this._searchEngine.search(text, {prefix: true, combineWith: 'AND'})
|
|
154
|
+
} else if (text.length > 1) {
|
|
155
|
+
results = this._searchEngine.search(text, {prefix: true})
|
|
156
|
+
}
|
|
157
|
+
const zincResults = [];
|
|
158
|
+
results.forEach(r => {
|
|
159
|
+
if (r.id in this.idMaps) {
|
|
160
|
+
zincResults.push(this.idMaps[r.id].zincObject);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return zincResults;
|
|
153
164
|
}
|
|
154
165
|
|
|
155
166
|
searchTerms(terms) {
|
|
@@ -174,25 +185,3 @@ export class SearchIndex
|
|
|
174
185
|
|
|
175
186
|
}
|
|
176
187
|
|
|
177
|
-
//==============================================================================
|
|
178
|
-
|
|
179
|
-
class SearchResults
|
|
180
|
-
{
|
|
181
|
-
constructor(results)
|
|
182
|
-
{
|
|
183
|
-
this.__results = results.sort((a, b) => (b.score - a.score));
|
|
184
|
-
this.__featureIds = results.map(r => r.featureId);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
get featureIds()
|
|
188
|
-
{
|
|
189
|
-
return this.__featureIds;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
get results()
|
|
193
|
-
{
|
|
194
|
-
return this.__results;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
//==============================================================================
|