Skip to content

Commit c197fb1

Browse files
author
Pete Saia
committed
fixed isElementSVG state property issue so it does not get overwritten by getInitialState method. #83
1 parent 101d897 commit c197fb1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/draggable.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ module.exports = React.createClass({
505505
onDrag: emptyFunction,
506506
onStop: emptyFunction,
507507
onMouseDown: emptyFunction,
508+
isElementSVG: false
508509
};
509510
},
510511

@@ -521,9 +522,6 @@ module.exports = React.createClass({
521522
// Current transform x and y.
522523
clientX: props.start.x, clientY: props.start.y,
523524

524-
// Can only determine if is SVG after mounted
525-
isElementSVG: false
526-
527525
};
528526
},
529527

@@ -681,8 +679,7 @@ module.exports = React.createClass({
681679
// without worrying about whether or not it is relatively or absolutely positioned.
682680
// If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
683681
// has a clean slate.
684-
var transform = this.state.isElementSVG ? null :
685-
createCSSTransform({
682+
var transform = createCSSTransform({
686683
// Set left if horizontal drag is enabled
687684
x: canDragX(this) ?
688685
this.state.clientX :
@@ -695,6 +692,8 @@ module.exports = React.createClass({
695692
});
696693

697694

695+
// This is primarily for IE as it ignores the CSS transform applied above
696+
// and only respects the real transform attribute.
698697
var svgTransform = !this.state.isElementSVG ? null :
699698
createSVGTransform({
700699
// Set left if horizontal drag is enabled

0 commit comments

Comments
 (0)