Opened 16 years ago
Closed 15 years ago
#1184 closed defect (fixed)
FloatingPane Resize correction
Reported by: | Owned by: | koranteng | |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | Widgets | Version: | 0.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
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);
}
}
}
Change History (4)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Milestone: | 0.4 → 0.5 |
---|
comment:3 Changed 15 years ago by
Owner: | changed from bill to koranteng |
---|
comment:4 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Andrei,
While it's not a super elegant solution. I did the following to fix that problem
In the function resizeTo(w, h) in FloatingPane?.js
MIN_WIDTH and MIN_HEIGHT are set in the contstructor.
Additionally, to fix another "error". In the checkSize(evt) function, this will "re"-maximize the window when the user resizes the window (regardless of method).