mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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.
|
||||
function update(minDistance, maxDistance) {
|
||||
var pt = point,
|
||||
// Set toolPoint to the previous point for moves or downPoint for
|
||||
// clicks, so mouseup has a delta spanning over the full drag.
|
||||
// Use the current point if this is the first mousedown, so
|
||||
// there's always a delta.
|
||||
toolPoint = (move ? tool._point : tool._downPoint) || pt;
|
||||
// Set toolPoint to the previous point for moves or downPoint
|
||||
// for clicks, so mouseup has a delta spanning over the full
|
||||
// drag. Use the current point if this is the first mousedown,
|
||||
// so there's always a delta.
|
||||
toolPoint = move ? tool._point : (tool._downPoint || pt);
|
||||
if (move) {
|
||||
if (tool._moveCount && pt.equals(toolPoint)) {
|
||||
return false;
|
||||
}
|
||||
if (minDistance != null || maxDistance != null) {
|
||||
if (toolPoint && (minDistance != null || maxDistance != null)) {
|
||||
var vector = pt.subtract(toolPoint),
|
||||
distance = vector.getLength();
|
||||
if (distance < (minDistance || 0))
|
||||
|
@ -327,7 +327,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
|||
tool._moveCount++;
|
||||
}
|
||||
tool._point = pt;
|
||||
tool._lastPoint = toolPoint;
|
||||
tool._lastPoint = toolPoint || pt;
|
||||
if (mouse.down) {
|
||||
tool._moveCount = -1;
|
||||
tool._downPoint = pt;
|
||||
|
|
Loading…
Reference in a new issue