|
|
@ -63,41 +63,54 @@ BI.LayerController = BI.inherit(BI.Controller, { |
|
|
|
var layout = BI.createWidget({ |
|
|
|
var layout = BI.createWidget({ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
invisible: true, |
|
|
|
invisible: true, |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
el: widget, |
|
|
|
{ |
|
|
|
left: 0, |
|
|
|
el: widget, |
|
|
|
right: 0, |
|
|
|
left: 0, |
|
|
|
top: 0, |
|
|
|
right: 0, |
|
|
|
bottom: 0 |
|
|
|
top: 0, |
|
|
|
}] |
|
|
|
bottom: 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}, context); |
|
|
|
}, context); |
|
|
|
BI.createWidget({ |
|
|
|
BI.createWidget({ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
element: op.container || this.options.render, |
|
|
|
element: op.container || this.options.render, |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
el: layout, |
|
|
|
{ |
|
|
|
left: offset.left || 0, |
|
|
|
el: layout, |
|
|
|
right: offset.right || 0, |
|
|
|
left: offset.left || 0, |
|
|
|
top: offset.top || 0, |
|
|
|
right: offset.right || 0, |
|
|
|
bottom: offset.bottom || 0 |
|
|
|
top: offset.top || 0, |
|
|
|
}] |
|
|
|
bottom: offset.bottom || 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (w) { |
|
|
|
if (w) { |
|
|
|
layout.element.addClass("bi-popup-view"); |
|
|
|
layout.element.addClass("bi-popup-view"); |
|
|
|
layout.element.css({ |
|
|
|
|
|
|
|
left: w.offset().left + (offset.left || 0), |
|
|
|
function getComputedPosition() { |
|
|
|
top: w.offset().top + (offset.top || 0), |
|
|
|
|
|
|
|
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "", |
|
|
|
var css = { |
|
|
|
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
layout.element.on("__resize__", function () { |
|
|
|
|
|
|
|
w.is(":visible") && |
|
|
|
|
|
|
|
layout.element.css({ |
|
|
|
|
|
|
|
left: w.offset().left + (offset.left || 0), |
|
|
|
left: w.offset().left + (offset.left || 0), |
|
|
|
top: w.offset().top + (offset.top || 0), |
|
|
|
top: w.offset().top + (offset.top || 0), |
|
|
|
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "", |
|
|
|
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "", |
|
|
|
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "" |
|
|
|
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "" |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { top, left, scaleY, scaleX } = BI.DOM.getPositionRelativeContainingBlockRect(layout.element[0]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css.top = (css.top - top) / scaleY; |
|
|
|
|
|
|
|
css.left = (css.left - left) / scaleX; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return css; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layout.element.css(getComputedPosition()); |
|
|
|
|
|
|
|
layout.element.on("__resize__", function () { |
|
|
|
|
|
|
|
w.is(":visible") && |
|
|
|
|
|
|
|
layout.element.css(getComputedPosition()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.add(name, widget, layout); |
|
|
|
this.add(name, widget, layout); |
|
|
|