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'
});
}
全站熱搜
留言列表