Show keyboard icon only when there are models

and so IFCViewer

https://community.openproject.com/projects/bim/work_packages/details/33122/overview
pull/8310/head
Aleix Suau 5 years ago
parent 4ea427ac4a
commit dbdeb7b99b
  1. 2
      frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
  2. 14
      frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts

@ -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)"

@ -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);
}

Loading…
Cancel
Save