Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Show keyboard icon only when there are models and so IFCViewer

Aleix Suaudbdeb7b99b60
diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
index 4c61bf07ddb..a0a68560393 100644
--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
@@ -16,7 +16,7 @@
</div>
<div class="ifc-model-viewer--container xeokit-busy-modal-backdrop">
- <div *ngIf="!keyboardEnabled"
+ <div *ngIf="modelCount && !keyboardEnabled"
class="ifc-model-viewer--focus-warning">
<a class="ifc-model-viewer--keyboard-disabled-icon icon-no-color icon-input-disabled"
(mousedown)="enableFromIcon($event)"
diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
index 30490dcc087..a0fe10c65fb 100644
--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
@@ -47,9 +47,7 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
})
export class IFCViewerComponent implements OnInit, OnDestroy {
private viewerUI:any;
-
- modelCount = this.ifcData.models.length;
-
+ modelCount:number;
canManage = this.ifcData.allowed('manage_ifc_models');
text = {
@@ -70,6 +68,8 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
}
ngOnInit():void {
+ this.modelCount = this.ifcData.models.length;
+
if (this.modelCount === 0) {
return;
}
@@ -94,13 +94,15 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
@HostListener('mousedown')
enableKeyBoard() {
- this.keyboardEnabled = true;
- this.ifcViewer.setKeyboardEnabled(true);
+ if (this.modelCount) {
+ this.keyboardEnabled = true;
+ this.ifcViewer.setKeyboardEnabled(true);
+ }
}
@HostListener('window:mousedown', ['$event.target'])
disableKeyboard(target:Element) {
- if (!this.outerContainer.nativeElement!.contains(target)) {
+ if (this.modelCount && !this.outerContainer.nativeElement!.contains(target)) {
this.keyboardEnabled = false;
this.ifcViewer.setKeyboardEnabled(false);
}