mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Fix #1032: Correctly handle lastPoint in first mousemove.
Improve first attempt of a fix in e054b760ed
This commit is contained in:
parent
e0a0cd58d5
commit
4f65996d34
1 changed files with 7 additions and 7 deletions
|
@ -303,16 +303,16 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
// is reached.
|
// is reached.
|
||||||
function update(minDistance, maxDistance) {
|
function update(minDistance, maxDistance) {
|
||||||
var pt = point,
|
var pt = point,
|
||||||
// Set toolPoint to the previous point for moves or downPoint for
|
// Set toolPoint to the previous point for moves or downPoint
|
||||||
// clicks, so mouseup has a delta spanning over the full drag.
|
// for clicks, so mouseup has a delta spanning over the full
|
||||||
// Use the current point if this is the first mousedown, so
|
// drag. Use the current point if this is the first mousedown,
|
||||||
// there's always a delta.
|
// so there's always a delta.
|
||||||
toolPoint = (move ? tool._point : tool._downPoint) || pt;
|
toolPoint = move ? tool._point : (tool._downPoint || pt);
|
||||||
if (move) {
|
if (move) {
|
||||||
if (tool._moveCount && pt.equals(toolPoint)) {
|
if (tool._moveCount && pt.equals(toolPoint)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (minDistance != null || maxDistance != null) {
|
if (toolPoint && (minDistance != null || maxDistance != null)) {
|
||||||
var vector = pt.subtract(toolPoint),
|
var vector = pt.subtract(toolPoint),
|
||||||
distance = vector.getLength();
|
distance = vector.getLength();
|
||||||
if (distance < (minDistance || 0))
|
if (distance < (minDistance || 0))
|
||||||
|
@ -327,7 +327,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
tool._moveCount++;
|
tool._moveCount++;
|
||||||
}
|
}
|
||||||
tool._point = pt;
|
tool._point = pt;
|
||||||
tool._lastPoint = toolPoint;
|
tool._lastPoint = toolPoint || pt;
|
||||||
if (mouse.down) {
|
if (mouse.down) {
|
||||||
tool._moveCount = -1;
|
tool._moveCount = -1;
|
||||||
tool._downPoint = pt;
|
tool._downPoint = pt;
|
||||||
|
|
Loading…
Reference in a new issue