Open
Description
How to use drag function with state? But when i use on move function i am guessing object will rerender and onmove is fired only once (checked with console.log). How to used it properly?
state = {
x: 10,
y: 10
}
y) => {
this.setState({x: x, y: y})
}
dy) => {
let x = this.state.x;
let y = this.state.y
this.setState({x: x + dx, y: y + dy})
}
end = (x, y) => {
this.setState({x: x, y: y})
}
render() {
return (
<div className="design_wrapper">
<div className="svg_container">
<Paper width={300} height={300}>
<Set>
<Circle key={"asdd"} x={this.state.x} y={this.state.y} r={15}
attr={{stroke: "#000", fill: "#000"}}
drag={{
move: this.onMove,
start: this.onstart,
end: this.end
}}/>
</Set>
</Paper>
</div>
</div>
);
}
}`
Metadata
Metadata
Assignees
Labels
No labels