Opened 12 years ago

Closed 12 years ago

#4515 closed defect (fixed)

splitContainer widget : connects to mousemove and mouseup need to be disconnected in "endSizing"

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

The splitContainer widget connects to 'onmousemove' and 'onmouseup' events in "beginSizing" method. These need to be disconnected in "endSizing" method.

Else on every resize- the number of times "changeSizing" and "endSizing" are called will increase, with the number of times you resize !

Worse still, any clicks in the widget will also call these functions as many times as the widget has been resized(coz of the mouse up connect)

This is very expensive if you have a lot widgets in the split content panes and you connect to the "endSizing", to resize all these widgets

Here is a test that will show the bug... Please place the following code in a html file and place the file in dojo-release-0.9.0dijit estslayout

code: <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html> <head>

<title>SplitContainer? Widget Demo</title>

<script type="text/javascript" src="../testBidi.js"></script> <script> function attachResize() {

var splitContObj = dijit.byId('mySplitContainer'); dojo.connect(splitContObj,"endSizing","resize")

} function resize() {

alert("endSizing called!");

} </script> <script type="text/javascript" src="../../../dojo/dojo.js"

djConfig="isDebug: true, parseOnLoad: true"></script>

<script type="text/javascript">

dojo.require("dijit.layout.SplitContainer?"); dojo.require("dijit.layout.ContentPane?"); dojo.require("dojo.parser"); scan page for widgets and instantiate them dojo.addOnLoad(attachResize)

</script> <style type="text/css">

@import "../../../dojo/resources/dojo.css"; @import "../../themes/tundra/tundra.css"; @import "../css/dijitTests.css"; .dojoContentPane {

padding:1em;

}

</style>

</head> <body class="tundra">

<h1 class="testTitle"> Dijit Split Container Test<br/> Resize the panes once and then click on any of the two boxes!<br/> Now resize again and click again.<br/> And again......<br/> The number of times "endsizing" is called increases propotionally with the number of times you resize!

</h1> <div dojoType="dijit.layout.SplitContainer?"

id='mySplitContainer' orientation="horizontal" sizerWidth="7" activeSizing="true" style="border: 1px solid #bfbfbf; float: left; width: 400px; height: 300px;"> <div dojoType="dijit.layout.ContentPane?" sizeMin="20" sizeShare="20">

click here after resizing..

</div> <div dojoType="dijit.layout.ContentPane?" sizeMin="50" sizeShare="50">

click here after resizing..

</div>

</div>

</body>

Attachments (2)

bug.html (1.8 KB) - added by guest 12 years ago.
This is a test that will show the bug
4515.patch (784 bytes) - added by dante 12 years ago.
fix for ticket pending approval?

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by guest

Attachment: bug.html added

This is a test that will show the bug

comment:1 Changed 12 years ago by bill

Milestone: 1.0
Owner: set to Adam Peller

Changed 12 years ago by dante

Attachment: 4515.patch added

fix for ticket pending approval?

comment:2 Changed 12 years ago by dante

peller -- patch attached, and tested against attached testcase. alert always fires only once as expected.

comment:3 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [10658]) Fixes #4515. Thanks, dante!

Note: See TracTickets for help on using tickets.