Fix disappearing of MyLocation point#7731
Conversation
|
Hello, any news about this PR? |
|
Hi Giovanni. Thanks for the fix and for your interest in improving TerriaJS. Can I suggest you tweak the implementation to be a bit more robust and generic? As far as I understand your idea, we want the app-generated "My Location" item to remain visible, even when the "Terrain hides underground features" checkbox is enabled. Your solution works, but it creates a coupling to i18n and to a very concrete instance of the item, which may be a leaky abstraction. Add a generic trait @primitiveTrait({
type: "boolean",
name: "Is Always Visible",
description:
"If true, points will render without depth testing so they remain visible through terrain and tiles."
})
isAlwaysVisible?: boolean = false;Set this trait on the app-created My Location marker in this._marker.setTrait(CommonStrata.user, "isAlwaysVisible", true);In disableDepthTestDistance: this.isAlwaysVisible
? new ConstantProperty(Number.POSITIVE_INFINITY)
: undefinedHopefully, this will be closer to TerriaJS’s architecture (avoiding name/i18n coupling and making the behaviour reusable). |
|
I agree with @niktayv's comment on moving the setting to somewhere that is more specific. This could be done in MyLocation.ts where the marker is created, by adding something like below: This is using the existing disableDepthTestDistance trait (which is honestly a bit hard to find) |
|
Hi @na9da, I tried the suggestion (and some variations), but it doesn't seem to work to fix the issue. |
|
Ah sorry! That's because when using simple-style for GeoJSON these other styling traits (like disableDepthTestDistance) are ignored. In that case I would use what @niktayv has suggested - to add a new trait and set that from MyLocation.ts - but maybe name the new boolean trait |
What this PR does
Fixes #7725
Checklist
doc/.