close
onMousedown(event: MouseEvent) {
console.log(event);
this.isMouseDown = true;
this.mouseStartX = event.pageX;
this.mouseStartY = event.pageY;
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
}

onMouseMove(event: MouseEvent) {
if (this.isMouseDown) {
this.mouseMoveX = (event.pageX - this.mouseStartX);
this.mouseMoveY = (event.pageY - this.mouseStartY);
// this._updatePosition(this.mouseMoveY + this.offsetY, this.mouseMoveX + this.offsetX);
this._updatePosition(this.mouseMoveY + this.mouseStartY - this.offsetY , this.mouseMoveX + this.mouseStartX - this.offsetX);
}
}

onMouseup() {
this.isMouseDown = false;
}

private _updatePosition(top: number, left: number) {
this.matDialogRef.updatePosition({
top: top + 'px',
left: left + 'px'
});
}
arrow
arrow
    全站熱搜
    創作者介紹

    Chill_Radio 發表在 痞客邦 留言(0) 人氣()