Skip to content

Commit 04fa857

Browse files
oetikerodeimaiz
authored andcommitted
fix iframe positioning (ITISFoundation#326)
fix iframe positioning
1 parent c366592 commit 04fa857

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

services/web/client/source/class/qxapp/component/widget/PersistentIframe.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ qx.Class.define("qxapp.component.widget.PersistentIframe", {
4545
},
4646
members: {
4747
__iframe: null,
48+
__syncScheduled: null,
4849
__actionButton: null,
4950
// override
5051
_createContentElement : function() {
@@ -96,11 +97,11 @@ qx.Class.define("qxapp.component.widget.PersistentIframe", {
9697
});
9798
this.addListener("move", e => {
9899
// got to let the new layout render first or we don't see it
99-
qx.event.Timer.once(this.__syncIframePos, this, 0);
100+
this.__syncIframePos();
100101
});
101102
this.addListener("resize", e => {
102103
// got to let the new layout render first or we don't see it
103-
qx.event.Timer.once(this.__syncIframePos, this, 0);
104+
this.__syncIframePos();
104105
});
105106
this.addListener("changeVisibility", e => {
106107
var visibility = e.getData()[0];
@@ -115,21 +116,28 @@ qx.Class.define("qxapp.component.widget.PersistentIframe", {
115116
return standin;
116117
},
117118
__syncIframePos: function() {
118-
let iframeParentPos = qx.bom.element.Location.get(qx.bom.element.Location.getOffsetParent(this.__iframe.getContentElement().getDomElement()), "scroll");
119-
let divPos = qx.bom.element.Location.get(this.getContentElement().getDomElement(), "scroll");
120-
let divSize = qx.bom.element.Dimension.getSize(this.getContentElement().getDomElement());
121-
this.__iframe.setLayoutProperties({
122-
top: divPos.top - iframeParentPos.top,
123-
left: (divPos.left - iframeParentPos.left)
124-
});
125-
this.__iframe.set({
126-
width: (divSize.width),
127-
height: (divSize.height)
128-
});
129-
this.__actionButton.setLayoutProperties({
130-
top: (divPos.top - iframeParentPos.top),
131-
right: (iframeParentPos.right - iframeParentPos.left - divPos.right)
132-
});
119+
if (this.__syncScheduled) {
120+
return;
121+
}
122+
this.__syncScheduled = true;
123+
window.setTimeout(() => {
124+
this.__syncScheduled = false;
125+
let iframeParentPos = qx.bom.element.Location.get(qx.bom.element.Location.getOffsetParent(this.__iframe.getContentElement().getDomElement()), "scroll");
126+
let divPos = qx.bom.element.Location.get(this.getContentElement().getDomElement(), "scroll");
127+
let divSize = qx.bom.element.Dimension.getSize(this.getContentElement().getDomElement());
128+
this.__iframe.setLayoutProperties({
129+
top: divPos.top - iframeParentPos.top,
130+
left: (divPos.left - iframeParentPos.left)
131+
});
132+
this.__iframe.set({
133+
width: (divSize.width),
134+
height: (divSize.height)
135+
});
136+
this.__actionButton.setLayoutProperties({
137+
top: (divPos.top - iframeParentPos.top),
138+
right: (iframeParentPos.right - iframeParentPos.left - divPos.right)
139+
});
140+
}, 0);
133141
},
134142
_applyShowMaximize: function(newValue, oldValue) {
135143
this._maximizeBtn.show();

0 commit comments

Comments
 (0)