Ticket #1184 (closed defect: fixed)
FloatingPane Resize correction
| Reported by: | andrei.neculau@… | Owned by: | koranteng |
|---|---|---|---|
| Priority: | high | Milestone: | 0.9 |
| Component: | Widgets | Version: | 0.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The Floating Pane can be resized "to negative values" too if you resize it past its starting points. I attach the way I've solved this.
What could be improved it's the "add 5 pixels" hack (see in the code) and making the title summarize when the text doesn't fit the width.
FloatingPane?.js, new postCreate:
postCreate: function(){
if(this.isShowing()){
this.width=-1; // force resize var mb = dojo.html.getMarginBox(this.domNode); this.resizeTo(mb.width, mb.height);
}
if (this.resizable){
// we cannot size correctly if any of our ancestors are hidden (display:none), // so temporarily attach to document.body if(this.domNode.parentNode){
var placeHolder = document.createElement("span"); dojo.html.insertBefore(placeHolder, this.domNode);
} dojo.body().appendChild(this.domNode); this.domNode.style.display = "";
var rh = dojo.widget.byId(this.widgetId+'_resize'); var titleBarSize = dojo.html.getMarginBox(this.titleBar); var titleBarContentSize = dojo.html.getContentBox(this.titleBar); var containerNodeContentSize = dojo.html.getContentBox(this.containerNode); var containerNodeSize = dojo.html.getMarginBox(this.containerNode); var resizeBarSize = dojo.html.getMarginBox(this.resizeBar);
var titleBarTextSize = dojo.html.getMarginBox(this.titleBarText); var titleBarIconSize = dojo.html.getMarginBox(this.titleBarIcon); var closeActionSize = dojo.html.getMarginBox(this.closeAction); var restoreActionSize = dojo.html.getMarginBox(this.restoreAction); var maximizeActionSize = dojo.html.getMarginBox(this.maximizeAction); var minimizeActionSize = dojo.html.getMarginBox(this.minimizeAction);
//added 5 as a stub - I guess that the browser adds one blank space because of the way the template is built (with new lines between the DIVs) var minWidth = 5+titleBarSize.width-titleBarContentSize.width+titleBarTextSize.width+titleBarIconSize.width+closeActionSize.width+restoreActionSize.width+maximizeActionSize.width+minimizeActionSize.width; var minHeight = titleBarSize.height+resizeBarSize.height+containerNodeSize.height-containerNodeContentSize.height;
this.titleBar.style.overflow="hide"; rh.minSize = {w: minWidth, h: minHeight}; this.domNode.style.display = "none";
// Put this.domNode back where it was originally if(placeHolder){
dojo.html.insertBefore(this.domNode, placeHolder); dojo.html.removeNode(placeHolder);
}
}
}