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

bugfix: remove unnecessary imports, use ev.button instead of ev.which

parent 2be46cce
No related branches found
No related tags found
No related merge requests found
import { Directive, Input, HostBinding, HostListener, ElementRef, OnChanges, Output, EventEmitter } from "@angular/core";
import { ConsoleReporter } from "jasmine";
@Directive({
selector: '[fixedMouseContextualContainerDirective]'
})
export class FixedMouseContextualContainerDirective implements OnChanges{
export class FixedMouseContextualContainerDirective {
private defaultPos: [number, number] = [-1e3, -1e3]
public isShown: boolean = false
......@@ -25,10 +24,6 @@ export class FixedMouseContextualContainerDirective implements OnChanges{
}
ngOnChanges(changes){
console.log({changes})
}
public show(){
this.transform = `translate(${this.mousePos.map(v => v.toString() + 'px').join(', ')})`
this.styleDisplay = 'block'
......@@ -51,16 +46,12 @@ export class FixedMouseContextualContainerDirective implements OnChanges{
@HostListener('document:click', ['$event'])
documentClick(event: MouseEvent){
if (event.which !== 3) {
console.log(event.target);
console.log(event.which);
if (event.button !== 2) {
if (this.styleDisplay === 'none')
return
if (this.el.nativeElement.contains(event.target))
return
this.hide()
}
}
}
\ No newline at end of file
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