Opened 16 years ago

Closed 15 years ago

#1184 closed defect (fixed)

FloatingPane Resize correction

Reported by: [email protected] Owned by: koranteng
Priority: high Milestone: 0.9
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:


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(){


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); = "";

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;"hide"; rh.minSize = {w: minWidth, h: minHeight}; = "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 [email protected]


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

		if (w < this.MIN_WIDTH || h < this.MIN_HEIGHT)

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).

	checkSize: function() {
		if (this.windowState == "maximized")

comment:2 Changed 16 years ago by bill

Milestone: 0.40.5

comment:3 Changed 15 years ago by koranteng

Owner: changed from bill to koranteng

comment:4 Changed 15 years ago by bill

Resolution: fixed
Status: newclosed

(In [7476]) Fixes #1184 (prevent resizing a floating pane to negative or zero size) Patch from Koranteng (IBM, CCLA on file).

Note: See TracTickets for help on using tickets.