mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-28 22:08:54 -04:00
Prepend non-public Tool methods with '_'.
This commit is contained in:
parent
1eff9741a4
commit
577c884a70
2 changed files with 12 additions and 12 deletions
|
@ -268,7 +268,7 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
|
|||
* }
|
||||
*/
|
||||
|
||||
updateEvent: function(type, pt, minDistance, maxDistance, start,
|
||||
_updateEvent: function(type, pt, minDistance, maxDistance, start,
|
||||
needsChange, matchMaxDistance) {
|
||||
if (!start) {
|
||||
if (minDistance != null || maxDistance != null) {
|
||||
|
@ -312,7 +312,7 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
|
|||
return true;
|
||||
},
|
||||
|
||||
onHandleEvent: function(type, pt, event) {
|
||||
_onHandleEvent: function(type, pt, event) {
|
||||
// Update global reference to this scope.
|
||||
paper = this._scope;
|
||||
// Handle removeOn* calls first
|
||||
|
@ -339,7 +339,7 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
|
|||
var called = false;
|
||||
switch (type) {
|
||||
case 'mousedown':
|
||||
this.updateEvent(type, pt, null, null, true, false, false);
|
||||
this._updateEvent(type, pt, null, null, true, false, false);
|
||||
if (this.responds(type))
|
||||
called = this.fire(type, new ToolEvent(this, type, event));
|
||||
break;
|
||||
|
@ -354,7 +354,7 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
|
|||
// case it is shorter than maxDistance, as this would produce weird
|
||||
// results. matchMaxDistance controls this.
|
||||
matchMaxDistance = false;
|
||||
while (this.updateEvent(type, pt, this.minDistance,
|
||||
while (this._updateEvent(type, pt, this.minDistance,
|
||||
this.maxDistance, false, needsChange, matchMaxDistance)) {
|
||||
if (this.responds(type))
|
||||
called = this.fire(type, new ToolEvent(this, type, event));
|
||||
|
@ -366,22 +366,22 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
|
|||
// If the last mouse drag happened in a different place, call mouse
|
||||
// drag first, then mouse up.
|
||||
if ((this._point.x != pt.x || this._point.y != pt.y)
|
||||
&& this.updateEvent('mousedrag', pt, this.minDistance,
|
||||
&& this._updateEvent('mousedrag', pt, this.minDistance,
|
||||
this.maxDistance, false, false, false)) {
|
||||
if (this.responds('mousedrag'))
|
||||
called = this.fire('mousedrag',
|
||||
new ToolEvent(this, type, event));
|
||||
}
|
||||
this.updateEvent(type, pt, null, this.maxDistance, false,
|
||||
this._updateEvent(type, pt, null, this.maxDistance, false,
|
||||
false, false);
|
||||
if (this.responds(type))
|
||||
called = this.fire(type, new ToolEvent(this, type, event));
|
||||
// Start with new values for 'mousemove'
|
||||
this.updateEvent(type, pt, null, null, true, false, false);
|
||||
this._updateEvent(type, pt, null, null, true, false, false);
|
||||
this._firstMove = true;
|
||||
break;
|
||||
case 'mousemove':
|
||||
while (this.updateEvent(type, pt, this.minDistance,
|
||||
while (this._updateEvent(type, pt, this.minDistance,
|
||||
this.maxDistance, this._firstMove, true, false)) {
|
||||
if (this.responds(type))
|
||||
called = this.fire(type, new ToolEvent(this, type, event));
|
||||
|
|
|
@ -474,7 +474,7 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
|
|||
}
|
||||
|
||||
if (tool = view._scope.tool)
|
||||
update = tool.onHandleEvent('mousedown', curPoint, event)
|
||||
update = tool._onHandleEvent('mousedown', curPoint, event)
|
||||
|| update;
|
||||
|
||||
if (update)
|
||||
|
@ -503,14 +503,14 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
|
|||
var onlyMove = !!(!tool.onMouseDrag && tool.onMouseMove);
|
||||
if (dragging && !onlyMove) {
|
||||
curPoint = point || curPoint;
|
||||
if (curPoint && tool.onHandleEvent('mousedrag', curPoint, event)) {
|
||||
if (curPoint && tool._onHandleEvent('mousedrag', curPoint, event)) {
|
||||
view.draw(true);
|
||||
DomEvent.stop(event);
|
||||
}
|
||||
// PORT: If there is only an onMouseMove handler, also call it when
|
||||
// the user is dragging:
|
||||
} else if ((!dragging || onlyMove)
|
||||
&& tool.onHandleEvent('mousemove', point, event)) {
|
||||
&& tool._onHandleEvent('mousemove', point, event)) {
|
||||
view.draw(true);
|
||||
DomEvent.stop(event);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
|
|||
dragging = false;
|
||||
curPoint = null;
|
||||
if (tool) {
|
||||
if (tool.onHandleEvent('mouseup', viewToProject(view, event),
|
||||
if (tool._onHandleEvent('mouseup', viewToProject(view, event),
|
||||
event)) {
|
||||
view.draw(true);
|
||||
DomEvent.stop(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue