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