mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Some jshint related fixes.
This commit is contained in:
parent
d92628a432
commit
810428569a
4 changed files with 11 additions and 16 deletions
|
@ -14,7 +14,6 @@
|
||||||
* @name PaperScript
|
* @name PaperScript
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
/* jshint -W082 */// Do not complain about functions inside Prepro.js statements
|
|
||||||
Base.exports.PaperScript = (function() {
|
Base.exports.PaperScript = (function() {
|
||||||
// Locally turn of exports and define for inlined acorn.
|
// Locally turn of exports and define for inlined acorn.
|
||||||
// Just declaring the local vars is enough, as they will be undefined.
|
// Just declaring the local vars is enough, as they will be undefined.
|
||||||
|
|
21
src/load.js
21
src/load.js
|
@ -15,22 +15,19 @@
|
||||||
// change. This is very useful during development of the library itself.
|
// change. This is very useful during development of the library itself.
|
||||||
if (typeof window === 'object') {
|
if (typeof window === 'object') {
|
||||||
// Browser based loading through Prepro.js:
|
// Browser based loading through Prepro.js:
|
||||||
|
|
||||||
/* jshint -W082 */
|
|
||||||
function load(src) {
|
|
||||||
document.write('<script src="' + src + '"></script>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.include) {
|
if (!window.include) {
|
||||||
// Get the last script tag and assume it's the one that loaded this file
|
// Get the last script tag and assume it's the one that loaded this file
|
||||||
// then get its src attribute and figure out the location of our root.
|
// then get its src attribute and figure out the location of our root.
|
||||||
var scripts = document.getElementsByTagName('script'),
|
var scripts = document.getElementsByTagName('script'),
|
||||||
src = scripts[scripts.length - 1].getAttribute('src');
|
src = scripts[scripts.length - 1].getAttribute('src'),
|
||||||
// Assume that we're loading from a non-root folder, either through
|
// Assume that we're loading from a non-root folder, either through
|
||||||
// ../../dist/paper-full.js, or directly through ../../src/load.js,
|
// ../../dist/paper-full.js, or directly through ../../src/load.js,
|
||||||
// and match root as all the parts of the path that lead to that folder,
|
// and match root as all the path's parts that lead to that folder,
|
||||||
// exclude the last bit (dist|src), since that's the sub-folder of paper
|
// exclude the last bit (dist|src), as that's a sub-folder of paper.
|
||||||
var root = src.match(/^(.*\/)\w*\//)[1];
|
root = src.match(/^(.*\/)\w*\//)[1],
|
||||||
|
load = function(src) {
|
||||||
|
document.write('<script src="' + src + '"></script>');
|
||||||
|
};
|
||||||
// First load the prepro's browser.js file, which provides the include()
|
// First load the prepro's browser.js file, which provides the include()
|
||||||
// function for the browser.
|
// function for the browser.
|
||||||
load(root + 'node_modules/prepro/lib/browser.js');
|
load(root + 'node_modules/prepro/lib/browser.js');
|
||||||
|
|
|
@ -181,8 +181,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
setClockwise: function(clockwise) {
|
setClockwise: function(clockwise) {
|
||||||
/* jshint -W018 */// Don't complain about confusing use of !:
|
if (this.isClockwise() ^ !!clockwise)
|
||||||
if (this.isClockwise() !== !!clockwise)
|
|
||||||
this.reverse();
|
this.reverse();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ PathItem.inject(new function() {
|
||||||
// Give both paths the same orientation except for subtraction
|
// Give both paths the same orientation except for subtraction
|
||||||
// and exclusion, where we need them at opposite orientation.
|
// and exclusion, where we need them at opposite orientation.
|
||||||
if (_path2 && (operator.subtract || operator.exclude)
|
if (_path2 && (operator.subtract || operator.exclude)
|
||||||
^ (_path2.isClockwise() !== _path1.isClockwise()))
|
^ (_path2.isClockwise() ^ _path1.isClockwise()))
|
||||||
_path2.reverse();
|
_path2.reverse();
|
||||||
// Split curves at crossings on both paths. Note that for self-
|
// Split curves at crossings on both paths. Note that for self-
|
||||||
// intersection, path2 is null and getIntersections() handles it.
|
// intersection, path2 is null and getIntersections() handles it.
|
||||||
|
|
Loading…
Reference in a new issue