mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-02-24 01:22:26 +01:00
Use setCapture to capture the mouse while dragging points.
This commit is contained in:
parent
0dfe585e6b
commit
4fd72fc51d
@ -114,6 +114,10 @@ var Graphic = React.createClass({
|
||||
if (this.props.onMouseDown) {
|
||||
this.props.onMouseDown(evt, this);
|
||||
}
|
||||
|
||||
if ('setCapture' in evt.target) {
|
||||
evt.target.setCapture();
|
||||
}
|
||||
},
|
||||
|
||||
mouseMove: function(evt) {
|
||||
@ -143,8 +147,8 @@ var Graphic = React.createClass({
|
||||
if(this.movingPoint) {
|
||||
this.ox = evt.offsetX - this.mx;
|
||||
this.oy = evt.offsetY - this.my;
|
||||
this.mp.x = this.cx + this.ox;
|
||||
this.mp.y = this.cy + this.oy;
|
||||
this.mp.x = Math.max(0, Math.min(this.defaultWidth, this.cx + this.ox));
|
||||
this.mp.y = Math.max(0, Math.min(this.defaultHeight, this.cy + this.oy));
|
||||
if (this.curve.forEach) {
|
||||
for (var i=0, c, _pts; i<this.curve.length; i++) {
|
||||
c = this.curve[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user