From 964d8cf7d61ae5b6b54104100e36953a638a4b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 10 Jun 2016 13:41:36 +0200 Subject: [PATCH] PaperScript: Only translate == to equals() calls for Point, Size and Color. Closes #1043 --- CHANGELOG.md | 2 ++ src/core/PaperScript.js | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac32b88..5e7cffba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,8 @@ contribute to the code. - `Matrix` properties `#b` and `#c` have been reversed to match common standard. - `#importSVG()`: improve handling of style inheritance for nested ``. - Move `PaperScript#execute()` URL argument into `options.url` (#902). +- PaperScript: Only translate `==` to `equals() calls for `Point`, `Size` and + `Color` (#1043). ### Added - Use unified code-base for browsers, Node.js, Electron, and anything diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index efb8f52b..d0d8e5bb 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -31,9 +31,8 @@ Base.exports.PaperScript = (function() { '*': '__multiply', '/': '__divide', '%': '__modulo', - // Use the real equals. - '==': 'equals', - '!=': 'equals' + '==': '__equals', + '!=': '__equals' }; var unaryOperators = { @@ -43,7 +42,7 @@ Base.exports.PaperScript = (function() { // Inject underscored math methods as aliases to Point, Size and Color. var fields = Base.each( - ['add', 'subtract', 'multiply', 'divide', 'modulo', 'negate'], + ['add', 'subtract', 'multiply', 'divide', 'modulo', 'equals', 'negate'], function(name) { // Create an alias for each math method to be injected into the // classes using Straps.js' #inject()