Skip to content

Commit

Permalink
Feature: prevent arrow key events from bubbling to document
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Nov 19, 2024
1 parent a6f5053 commit d9a3e54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/src/elements/ngm-cam-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export class NgmCamConfiguration extends LitElementI18n {
super.disconnectedCallback();
}


updated(changedProperties: PropertyValues) {
if (this.viewer && !this.unlistenPostRender) {
this.scene = this.viewer.scene;
Expand All @@ -172,7 +173,7 @@ export class NgmCamConfiguration extends LitElementI18n {
updateFromCamera() {
const camera = this.scene!.camera;
const pc = camera.positionCartographic;
const altitude = this.scene!.globe.getHeight(pc) || 0;
const altitude = this.scene!.globe.getHeight(pc) ?? 0;
this.elevation = pc.height - altitude;
this.pitch = Math.round(CesiumMath.toDegrees(camera.pitch));
let heading = Math.round(CesiumMath.toDegrees(camera.heading));
Expand All @@ -187,7 +188,7 @@ export class NgmCamConfiguration extends LitElementI18n {
}

updateHeight(value: number) {
const altitude = this.scene!.globe.getHeight(this.scene!.camera.positionCartographic) || 0;
const altitude = this.scene!.globe.getHeight(this.scene!.camera.positionCartographic) ?? 0;
NavToolsStore.setCameraHeight(value + altitude);
}

Expand Down Expand Up @@ -342,6 +343,7 @@ export class NgmCamConfiguration extends LitElementI18n {
step=${c.step}
.value=${c.getValue()}
@input=${c.onSliderChange}
@keydown="${(e) => { if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') e.stopPropagation(); }}"
/>
</div>
</div>`)}
Expand Down

0 comments on commit d9a3e54

Please sign in to comment.