8000 fix(sidenav): recalculate sidenavWidth inside onDragStart · code-tree/material@e12b31c · GitHub
[go: up one dir, main page]

Skip to content

Commit e12b31c

Browse files
committed
fix(sidenav): recalculate sidenavWidth inside onDragStart
sidenavWidth may change due to orientation and other factors, so must be recalculated upon drag start.
1 parent d97349e commit e12b31c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/sidenav/sidenav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
334334
.on('$md.drag', onDrag)
335335
.on('$md.dragend', onDragEnd);
336336

337-
var style = getComputedStyle(element[0]);
338-
var sidenavWidth = parseInt(style.width);
337+
var sidenavWidth;
339338
var isRightSidenav = element.hasClass('md-sidenav-right');
340339
var accelerationBound = 6;
341340

@@ -346,6 +345,7 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
346345
var isQuickDrag = false;
347346

348347
function onDragStart() {
348+
sidenavWidth = parseInt(getComputedStyle(element[0]).width);
349349
if (element.hasClass('md-locked-open')) {
350350
dragCancelled = true;
351351
} else {

0 commit comments

Comments
 (0)
0