Skip to content

Commit

Permalink
Info.go
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Mar 28, 2024
1 parent c26813e commit 87069e9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3002,6 +3002,7 @@ function layerPopulateVariable(modalId, layerType) {
which: "last",
icon: "material design icon",
value: "Prop: {prop}",
go: false,
},
];
currentLayerVars.markerIcon = currentLayerVars.markerIcon || {
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/Configure/Layers/Vector/Vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ Example:
{
"which": "last",
"icon": "material design icon",
"value": "Prop: {prop}"
"value": "Prop: {prop}",
"go": false
}
],
"layerAttachments": {
Expand Down Expand Up @@ -272,6 +273,7 @@ Example:
- `which`: This only supports the value `last` at this point.
- `icon`: Any [Material Design Icon](http://materialdesignicons.com/) name
- `value`: A name to display. All `{prop}`s will be replaced by their corresponding `features[which].properties[prop]` value.
- `go`: Boolean that, if true, pans and zooms to the feature of `which` on intial load. The zoom used is Map Scale Zoom or the current zoom. Only the first feature with info.go is gone to.
- `layerAttachments`: Attachments that may apply to the entire layer.
- `labels`: Place a label beside each feature. Also applies to `coordinateAttachments.marker` features.
- `initialVisibility`: Whether the label sublayer is initially on. Users can toggle sublayers on and off in the layer settings in the LayersTool.
Expand Down
16 changes: 16 additions & 0 deletions src/essence/Ancillary/Description.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const Description = {
descPoint: null,
tippyDesc: null,
L_: null,
_infoAlreadyGone: false,
init: function (mission, site, Map_, L_) {
this.L_ = L_
this.Map_ = Map_
Expand Down Expand Up @@ -140,6 +141,20 @@ const Description = {
l.variables.info[i].icon +
" mdi-18px'></i>"
newInfo += '<div>' + infoText + '</div></div>'

// Go initially
if (Description._infoAlreadyGone == false) {
if (l.variables.info[i].go == true) {
if (lat != null && lng != null) {
Description.Map_.map.setView(
[lat, lng],
Description.Map_.mapScaleZoom ||
Description.Map_.map.getZoom()
)
}
Description._infoAlreadyGone = true
}
}
}
if (newInfo.length > 0) infos.push(newInfo)
}
Expand All @@ -166,6 +181,7 @@ const Description = {
)
}
})
Description._infoAlreadyGone = true
},
updatePoint: function (activeLayer) {
if (
Expand Down
3 changes: 2 additions & 1 deletion src/essence/Ancillary/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ function getSearchFieldStringForFeature(name, props) {
str += Math.round(F_.getIn(props, sf[i][1]))
break
case 'rmunder':
str += F_.getIn(props, sf[i][1]).replace('_', ' ')
if (F_.getIn(props, sf[i][1]))
str += F_.getIn(props, sf[i][1]).replace('_', ' ')
break
}
if (i != sf.length - 1) str += ' '
Expand Down
6 changes: 5 additions & 1 deletion src/external/Leaflet/leaflet.hotline.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
canvas.width = 1
canvas.height = 256
for (var i in palette) {
gradient.addColorStop(i, palette[i])
try {
gradient.addColorStop(i, palette[i])
} catch (err) {
console.warn(`Hotline gradient - Bad color: ${palette[i]}`)
}
}
ctx.fillStyle = gradient
ctx.fillRect(0, 0, 1, 256)
Expand Down

0 comments on commit 87069e9

Please sign in to comment.