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. 10
      frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts

@ -16,7 +16,7 @@
</div> </div>
<div class="ifc-model-viewer--container xeokit-busy-modal-backdrop"> <div class="ifc-model-viewer--container xeokit-busy-modal-backdrop">
<div *ngIf="!keyboardEnabled" <div *ngIf="modelCount && !keyboardEnabled"
class="ifc-model-viewer--focus-warning"> class="ifc-model-viewer--focus-warning">
<a class="ifc-model-viewer--keyboard-disabled-icon icon-no-color icon-input-disabled" <a class="ifc-model-viewer--keyboard-disabled-icon icon-no-color icon-input-disabled"
(mousedown)="enableFromIcon($event)" (mousedown)="enableFromIcon($event)"

@ -47,9 +47,7 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
}) })
export class IFCViewerComponent implements OnInit, OnDestroy { export class IFCViewerComponent implements OnInit, OnDestroy {
private viewerUI:any; private viewerUI:any;
modelCount:number;
modelCount = this.ifcData.models.length;
canManage = this.ifcData.allowed('manage_ifc_models'); canManage = this.ifcData.allowed('manage_ifc_models');
text = { text = {
@ -70,6 +68,8 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
} }
ngOnInit():void { ngOnInit():void {
this.modelCount = this.ifcData.models.length;
if (this.modelCount === 0) { if (this.modelCount === 0) {
return; return;
} }
@ -94,13 +94,15 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
@HostListener('mousedown') @HostListener('mousedown')
enableKeyBoard() { enableKeyBoard() {
if (this.modelCount) {
this.keyboardEnabled = true; this.keyboardEnabled = true;
this.ifcViewer.setKeyboardEnabled(true); this.ifcViewer.setKeyboardEnabled(true);
} }
}
@HostListener('window:mousedown', ['$event.target']) @HostListener('window:mousedown', ['$event.target'])
disableKeyboard(target:Element) { disableKeyboard(target:Element) {
if (!this.outerContainer.nativeElement!.contains(target)) { if (this.modelCount && !this.outerContainer.nativeElement!.contains(target)) {
this.keyboardEnabled = false; this.keyboardEnabled = false;
this.ifcViewer.setKeyboardEnabled(false); this.ifcViewer.setKeyboardEnabled(false);
} }

Loading…
Cancel
Save