Some jshint related fixes.

This commit is contained in:
Jürg Lehni 2016-01-27 11:45:20 +01:00
parent d92628a432
commit 810428569a
4 changed files with 11 additions and 16 deletions

View file

@ -14,7 +14,6 @@
* @name PaperScript
* @namespace
*/
/* jshint -W082 */// Do not complain about functions inside Prepro.js statements
Base.exports.PaperScript = (function() {
// Locally turn of exports and define for inlined acorn.
// Just declaring the local vars is enough, as they will be undefined.

View file

@ -15,22 +15,19 @@
// change. This is very useful during development of the library itself.
if (typeof window === 'object') {
// Browser based loading through Prepro.js:
/* jshint -W082 */
function load(src) {
document.write('<script src="' + src + '"></script>');
}
if (!window.include) {
// 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.
var scripts = document.getElementsByTagName('script'),
src = scripts[scripts.length - 1].getAttribute('src');
// Assume that we're loading from a non-root folder, either through
// ../../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,
// exclude the last bit (dist|src), since that's the sub-folder of paper
var root = src.match(/^(.*\/)\w*\//)[1];
src = scripts[scripts.length - 1].getAttribute('src'),
// Assume that we're loading from a non-root folder, either through
// ../../dist/paper-full.js, or directly through ../../src/load.js,
// and match root as all the path's parts that lead to that folder,
// exclude the last bit (dist|src), as that's a sub-folder of paper.
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()
// function for the browser.
load(root + 'node_modules/prepro/lib/browser.js');

View file

@ -181,8 +181,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
},
setClockwise: function(clockwise) {
/* jshint -W018 */// Don't complain about confusing use of !:
if (this.isClockwise() !== !!clockwise)
if (this.isClockwise() ^ !!clockwise)
this.reverse();
},

View file

@ -90,7 +90,7 @@ PathItem.inject(new function() {
// Give both paths the same orientation except for subtraction
// and exclusion, where we need them at opposite orientation.
if (_path2 && (operator.subtract || operator.exclude)
^ (_path2.isClockwise() !== _path1.isClockwise()))
^ (_path2.isClockwise() ^ _path1.isClockwise()))
_path2.reverse();
// Split curves at crossings on both paths. Note that for self-
// intersection, path2 is null and getIntersections() handles it.