Opened 13 years ago
Closed 13 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"
<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)
Change History (5)
Changed 13 years ago by
comment:1 Changed 13 years ago by
Milestone: | → 1.0 |
---|---|
Owner: | set to Adam Peller |
comment:2 Changed 13 years ago by
peller -- patch attached, and tested against attached testcase. alert always fires only once as expected.
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is a test that will show the bug