| 371 | | var horizontal = this.horizontal; |
| 372 | | this._pageStart = horizontal ? e.pageY : e.pageX; |
| 373 | | var dim = horizontal ? 'h' : 'w'; |
| 374 | | this._childStart = dojo.marginBox(this.child.domNode)[dim]; |
| 375 | | this._splitterStart = parseInt(this.domNode.style[this.region]); |
| | 375 | |
| | 376 | //Performance: load data info local vars for onmousevent function closure |
| | 377 | var factor = this._factor, |
| | 378 | max = this._maxSize, |
| | 379 | min = this._minSize || 10, |
| | 380 | axis = this.horizontal ? "pageY" : "pageX", |
| | 381 | pageStart = e[axis], |
| | 382 | splitterStyle = this.domNode.style, |
| | 383 | dim = this.horizontal ? 'h' : 'w', |
| | 384 | childStart = dojo.marginBox(this.child.domNode)[dim], |
| | 385 | splitterStart = parseInt(this.domNode.style[this.region]), |
| | 386 | resize = this._resize, |
| | 387 | region = this.region, |
| | 388 | mb = {}, |
| | 389 | childNode = this.child.domNode, |
| | 390 | layoutFunc = dojo.hitch(this.container, this.container._layoutChildren); |
| | 391 | |
| 378 | | dojo.connect(de, "onmousemove", this, "_drag"), |
| | 394 | dojo.connect(de, "onmousemove", this._drag = function(e, forceResize){ |
| | 395 | var delta = e[axis] - pageStart; |
| | 396 | var childSize = factor * delta + childStart; |
| | 397 | var boundChildSize = Math.max(Math.min(childSize, max), min); |
| | 398 | if(resize || forceResize){ |
| | 399 | mb[dim] = boundChildSize; |
| | 400 | dojo.marginBox(childNode, mb); |
| | 401 | layoutFunc(region); |
| | 402 | } |
| | 403 | splitterStyle[region] = factor * delta + splitterStart + (boundChildSize - childSize) + "px"; |
| | 404 | dojo.stopEvent(e); |
| | 405 | }), |
| 383 | | }, |
| 384 | | |
| 385 | | _computeMaxSize: function(){ |
| 386 | | var dim = this.horizontal ? 'h' : 'w'; |
| 387 | | var available = dojo.contentBox(this.container.domNode)[dim] - (this.oppNode ? dojo.marginBox(this.oppNode)[dim] : 0); //FIXME: what if this.oppNode is undefined? |
| 388 | | this._maxSize = Math.min(this.child.maxSize, available); |
| 389 | | }, |
| 390 | | |
| 391 | | _drag: function(e){ |
| 392 | | var delta = (this.horizontal ? e.pageY : e.pageX) - this._pageStart; |
| 393 | | var childSize = this._factor * delta + this._childStart; |
| 394 | | var boundChildSize = Math.max(Math.min(childSize, this._maxSize), this._minSize || 10); |
| 395 | | if(this._resize){ |
| 396 | | this._move(delta, boundChildSize); |
| 397 | | } |
| 398 | | var splitterEdge = this._factor * delta + this._splitterStart + (boundChildSize - childSize); |
| 399 | | this.domNode.style[this.region] = splitterEdge + "px"; |
| 400 | | dojo.stopEvent(e); |
| 401 | | }, |
| 402 | | |
| 403 | | _move: function(/*Number*/delta, childSize){ |
| 404 | | var mb = {}; |
| 405 | | mb[ this.horizontal ? "h" : "w"] = childSize; |
| 406 | | dojo.marginBox(this.child.domNode, mb); |
| 407 | | this.container._layoutChildren(this.region); |
| 449 | | this._computeMaxSize(); |
| 450 | | var childSize = dojo.marginBox(this.child.domNode)[ horizontal ? 'h' : 'w' ]; |
| 451 | | childSize = Math.max(Math.min(childSize, this._maxSize), this._minSize); |
| 452 | | this._move(tick, childSize); |
| | 450 | var childSize = dojo.marginBox(this.child.domNode)[ horizontal ? 'h' : 'w' ] + this._factor * tick; |
| | 451 | var mb = {}; |
| | 452 | mb[ this.horizontal ? "h" : "w"] = Math.max(Math.min(childSize, this._maxSize), this._minSize); |
| | 453 | dojo.marginBox(this.child.domNode, mb); |
| | 454 | this.container._layoutChildren(this.region); |