Commit ff29b190 authored by rockyl's avatar rockyl

修复html视图不能滚动的限制

parent 43f8406e
{"id":"engine","url":"engine.85a610a71df748fd9a6ece34f456a06e8f3f1b63.js"} {"id":"engine","url":"engine.47eb390007c368d3dc5648734153301ebead724b.js"}
\ No newline at end of file \ No newline at end of file
...@@ -83,7 +83,20 @@ export class FloatDisplay extends DisplayObject { ...@@ -83,7 +83,20 @@ export class FloatDisplay extends DisplayObject {
} }
}); });
s.addEventListener(Event.ADDED_TO_STAGE, function (e: Event) { s.addEventListener(Event.ADDED_TO_STAGE, function (e: Event) {
if(!container){ this.addHtmlElement();
}, s);
this._transformID = -1;
}
addHtmlElement() {
let s = this;
if(!s.stage){
return;
}
if (!container) {
container = document.createElement('div'); container = document.createElement('div');
container.style.position = "absolute"; container.style.position = "absolute";
container.style.left = "0"; container.style.left = "0";
...@@ -104,9 +117,6 @@ export class FloatDisplay extends DisplayObject { ...@@ -104,9 +117,6 @@ export class FloatDisplay extends DisplayObject {
} }
} }
} }
});
this._transformID = -1;
} }
get htmlElement() { get htmlElement() {
...@@ -126,7 +136,7 @@ export class FloatDisplay extends DisplayObject { ...@@ -126,7 +136,7 @@ export class FloatDisplay extends DisplayObject {
* @param {HtmlElement} htmlElement 需要封装起来的html元素的引用。你可以通过这个引用来调用或设置此元素自身的属性方法和事件,甚至是样式 * @param {HtmlElement} htmlElement 需要封装起来的html元素的引用。你可以通过这个引用来调用或设置此元素自身的属性方法和事件,甚至是样式
*/ */
protected init(htmlElement: any): void { protected init(htmlElement: any): void {
if(!htmlElement){ if (!htmlElement) {
return; return;
} }
let s = this; let s = this;
...@@ -160,6 +170,8 @@ export class FloatDisplay extends DisplayObject { ...@@ -160,6 +170,8 @@ export class FloatDisplay extends DisplayObject {
s._localBoundsSelf.width = w; s._localBoundsSelf.width = w;
s._localBoundsSelf.height = h; s._localBoundsSelf.height = h;
s._htmlElement = she; s._htmlElement = she;
this.addHtmlElement();
} }
/** /**
......
...@@ -438,7 +438,7 @@ export class Stage extends Container { ...@@ -438,7 +438,7 @@ export class Stage extends Container {
s.dispatchEvent(Event.ON_INIT_STAGE); s.dispatchEvent(Event.ON_INIT_STAGE);
// } // }
}, 100); }, 100);
let rc = canvas;//s.rootDiv; let rc = s.rootDiv;//canvas
let mouseEvent = s.onMouseEvent.bind(s); let mouseEvent = s.onMouseEvent.bind(s);
//鼠标事件 //鼠标事件
if (osType != "pc") { if (osType != "pc") {
...@@ -648,8 +648,9 @@ export class Stage extends Container { ...@@ -648,8 +648,9 @@ export class Stage extends Container {
cp = new Point(); cp = new Point();
} }
let rootDiv = s.rootDiv;
let doc = document.documentElement; let doc = document.documentElement;
let box = points[o].target.getBoundingClientRect(); let box = rootDiv.getBoundingClientRect();//points[o].target
let left = box.left + window.pageXOffset - doc.clientLeft; let left = box.left + window.pageXOffset - doc.clientLeft;
let top = box.top + window.pageYOffset - doc.clientTop; let top = box.top + window.pageYOffset - doc.clientTop;
cp.x = (points[o].pageX - left) * devicePixelRatio; cp.x = (points[o].pageX - left) * devicePixelRatio;
......
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