Skip to content
Snippets Groups Projects
Commit 9cf9dddb authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: no dockedContainer === no minimise icon

parent 713dc886
No related branches found
No related tags found
No related merge requests found
import { Component, ViewChild, ViewContainerRef,ComponentRef, HostBinding, HostListener, Output, EventEmitter, Input, ElementRef } from "@angular/core";
import { Component, ViewChild, ViewContainerRef,ComponentRef, HostBinding, HostListener, Output, EventEmitter, Input, ElementRef, OnInit } from "@angular/core";
import { WidgetServices } from "./widgetService.service";
......@@ -9,7 +9,7 @@ import { WidgetServices } from "./widgetService.service";
]
})
export class WidgetUnit {
export class WidgetUnit implements OnInit{
@ViewChild('container',{read:ViewContainerRef}) container : ViewContainerRef
@ViewChild('emptyspan',{read:ElementRef}) emtpy : ElementRef
......@@ -22,6 +22,13 @@ export class WidgetUnit {
@HostBinding('style.height')
height : string = this.state === 'docked' ? null : '0px'
get transform(){
return this.state === 'floating' ?
`translate(${this.position[0]}px, ${this.position[1]}px)` :
`translate(0 , 0)`
}
public canBeDocked: boolean = false
@HostListener('mousedown')
clicked(){
this.clickedEmitter.emit(this)
......@@ -44,6 +51,10 @@ export class WidgetUnit {
public cf : ComponentRef<WidgetUnit>
public widgetServices:WidgetServices
ngOnInit(){
this.canBeDocked = typeof this.widgetServices.dockedContainer !== 'undefined'
}
/**
* @param {boolean}
* @description when new viewer is init, if this viewer will persist
......@@ -131,10 +142,4 @@ export class WidgetUnit {
ev.dataTransfer.setDragImage(this.emtpy.nativeElement, 0, 0)
}
get transform(){
return this.state === 'floating' ?
`translate(${this.position[0]}px, ${this.position[1]}px)` :
`translate(0 , 0)`
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@
</div>
</div>
<div icons>
<i *ngIf = "state === 'floating'"
<i *ngIf = "canBeDocked && state === 'floating'"
(click) = "dock($event)"
class = "fas fa-window-minimize"
hoverable></i>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment