mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Use double underscores to avoid clashes between math operators and 'private' methods.
Path already defines a #_add() method...
This commit is contained in:
parent
6d5e4329c1
commit
ee7fd8cdbe
1 changed files with 9 additions and 7 deletions
|
@ -44,18 +44,18 @@ paper.PaperScope.prototype.PaperScript = (function(root) {
|
||||||
|
|
||||||
var binaryOperators = {
|
var binaryOperators = {
|
||||||
// The hidden math functions are to be injected specifically, see below.
|
// The hidden math functions are to be injected specifically, see below.
|
||||||
'+': '_add',
|
'+': '__add',
|
||||||
'-': '_subtract',
|
'-': '__subtract',
|
||||||
'*': '_multiply',
|
'*': '__multiply',
|
||||||
'/': '_divide',
|
'/': '__divide',
|
||||||
'%': '_modulo',
|
'%': '__modulo',
|
||||||
// Use the real equals.
|
// Use the real equals.
|
||||||
'==': 'equals',
|
'==': 'equals',
|
||||||
'!=': 'equals'
|
'!=': 'equals'
|
||||||
};
|
};
|
||||||
|
|
||||||
var unaryOperators = {
|
var unaryOperators = {
|
||||||
'-': '_negate',
|
'-': '__negate',
|
||||||
'+': null
|
'+': null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,9 @@ paper.PaperScope.prototype.PaperScript = (function(root) {
|
||||||
var fields = Base.each(
|
var fields = Base.each(
|
||||||
['add', 'subtract', 'multiply', 'divide', 'modulo', 'negate'],
|
['add', 'subtract', 'multiply', 'divide', 'modulo', 'negate'],
|
||||||
function(name) {
|
function(name) {
|
||||||
this['_' + name] = '#' + name;
|
// Create an alias for ach math function to be injected into the
|
||||||
|
// classes using Straps.js' #inject()
|
||||||
|
this['__' + name] = '#' + name;
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue