Commit 6d5d91df authored by rockyl's avatar rockyl

处理点击坐标偏移的问题

parent daa313f5
{"id":"engine","url":"engine.50cdcef6ebe4e8c0fbc624f9d4fbf225102c5750.js"} {"id":"engine","url":"engine.56879c475b493bdd1b4fa1522bad7ad2a4d454e7.js"}
\ No newline at end of file \ No newline at end of file
...@@ -647,8 +647,14 @@ export class Stage extends Container { ...@@ -647,8 +647,14 @@ export class Stage extends Container {
} else { } else {
cp = new Point(); cp = new Point();
} }
cp.x = (points[o].clientX - points[o].target.offsetLeft + window.pageXOffset) * devicePixelRatio;
cp.y = (points[o].clientY - points[o].target.offsetTop + window.pageYOffset) * devicePixelRatio; let doc = document.documentElement;
let box = points[o].target.getBoundingClientRect();
let left = box.left + window.pageXOffset - doc.clientLeft;
let top = box.top + window.pageYOffset - doc.clientTop;
cp.x = (points[o].pageX - left) * devicePixelRatio;
cp.y = (points[o].pageY - top) * devicePixelRatio;
//计算舞台中的点 //计算舞台中的点
sp = s.globalToLocal(cp, DisplayObject._bp); sp = s.globalToLocal(cp, DisplayObject._bp);
//检查是否有鼠标事件 //检查是否有鼠标事件
...@@ -1011,11 +1017,11 @@ export class Stage extends Container { ...@@ -1011,11 +1017,11 @@ export class Stage extends Container {
} }
afterUpdateTransform() { afterUpdateTransform() {
this.calculateBounds(); /*this.calculateBounds();
if (this.layoutInvalid) { if (this.layoutInvalid) {
this.dispatchEvent(Event.LAYOUT_INVALID); this.dispatchEvent(Event.LAYOUT_INVALID);
this.layoutInvalid = false; this.layoutInvalid = false;
} }*/
} }
public destroy(): void { public destroy(): void {
......
...@@ -92,7 +92,6 @@ class AdjustProxy { ...@@ -92,7 +92,6 @@ class AdjustProxy {
} }
adjustLayout() { adjustLayout() {
return;
const that = this._host; const that = this._host;
const {width: pWidth, height: pHeight} = that.parent; const {width: pWidth, height: pHeight} = that.parent;
......
Markdown is supported
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