#5569 closed bug (fixed)
Draggable: Containment incorrectly calculates padding and border
Reported by: | Daazku | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.10.2 |
Component: | ui.draggable | Version: | 1.8 |
Keywords: | haspatch | Cc: | |
Blocked by: | Blocking: |
Description
Draggable containement calculation is wrong because
this.containment = [ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top ];
should be
this.containment = [ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderRightWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderBottomWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top ];
(replaced borderLeftWidth by borderRightWidth for right containement and same for bottom)
Change History (7)
comment:1 Changed 11 years ago by
Milestone: | TBD → 2.0.0 |
---|
comment:2 Changed 11 years ago by
Keywords: | haspatch added; containement removed |
---|---|
Status: | new → open |
comment:3 Changed 11 years ago by
Summary: | Containment size calculation is wrong. → Draggable: Containment incorrectly calculates padding and border |
---|
comment:4 Changed 11 years ago by
Test case - http://jsfiddle.net/tj_vantoll/maP9S/. I verified that the recommended fix indeed fixes the problem.
comment:6 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Draggable: Fix border containment. Fixed #5569 - Draggable: Containment incorrectly calculates padding and border
Changeset: 6358695df18722d8c7e99437365db42cf4957626
comment:7 Changed 11 years ago by
Milestone: | 2.0.0 → 1.10.2 |
---|
Note: See
TracTickets for help on using
tickets.
confirmed, the new location of the code is: https://github.com/jquery/jquery-ui/blob/039ee746d3eaeeaa4ad92ecd8ebf4e6fcd11768c/ui/jquery.ui.draggable.js#L381