mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Update JSHint and fix some some hinting errors.
This commit is contained in:
parent
da78e837a1
commit
e15de78347
6 changed files with 39 additions and 37 deletions
|
@ -1,16 +1,17 @@
|
|||
{
|
||||
"esversion": 5,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"wsh": true,
|
||||
"evil": true,
|
||||
"trailing": false,
|
||||
"smarttabs": false,
|
||||
"sub": true,
|
||||
"supernew": true,
|
||||
"laxbreak": true,
|
||||
"eqeqeq": false,
|
||||
"eqnull": true,
|
||||
"loopfunc": true,
|
||||
"boss": true,
|
||||
"shadow": true
|
||||
"shadow": true,
|
||||
"funcscope": false,
|
||||
"latedef": "nofunc",
|
||||
"freeze": true
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
"gulp-util": "^3.0.0",
|
||||
"gulp-webserver": "^0.9.1",
|
||||
"gulp-whitespace": "^0.1.0",
|
||||
"gulp-zip": "^3.0.2",
|
||||
"jshint": "2.8.x",
|
||||
"gulp-zip": "^3.2.0",
|
||||
"jshint": "^2.9.2",
|
||||
"jshint-summary": "^0.4.0",
|
||||
"merge-stream": "^1.0.0",
|
||||
"prepro": "^2.4.0",
|
||||
|
|
|
@ -1893,6 +1893,7 @@ new function() { // Injection scope for hit-test functions shared with project
|
|||
|| options.class && !(this instanceof options.class)),
|
||||
callback = options.match,
|
||||
that = this,
|
||||
bounds,
|
||||
res;
|
||||
|
||||
function match(hit) {
|
||||
|
@ -1913,7 +1914,7 @@ new function() { // Injection scope for hit-test functions shared with project
|
|||
if (checkSelf && (options.center || options.bounds) && this._parent) {
|
||||
// Don't get the transformed bounds, check against transformed
|
||||
// points instead
|
||||
var bounds = this.getInternalBounds();
|
||||
bounds = this.getInternalBounds();
|
||||
if (options.center) {
|
||||
res = checkBounds('center', 'Center');
|
||||
}
|
||||
|
|
|
@ -1285,6 +1285,13 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
|
||||
// NOTE: Documentation is in PathItem#smooth()
|
||||
smooth: function(options) {
|
||||
var that = this,
|
||||
opts = options || {},
|
||||
type = opts.type || 'asymmetric',
|
||||
segments = this._segments,
|
||||
length = segments.length,
|
||||
closed = this._closed;
|
||||
|
||||
// Helper method to pick the right from / to indices.
|
||||
// Supports numbers and segment objects.
|
||||
// For numbers, the `to` index is exclusive, while for segments and
|
||||
|
@ -1313,15 +1320,10 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
: index < 0 ? index + length : index, length - 1);
|
||||
}
|
||||
|
||||
var that = this,
|
||||
opts = options || {},
|
||||
type = opts.type || 'asymmetric',
|
||||
segments = this._segments,
|
||||
length = segments.length,
|
||||
closed = this._closed,
|
||||
loop = closed && opts.from === undefined && opts.to === undefined,
|
||||
var loop = closed && opts.from === undefined && opts.to === undefined,
|
||||
from = getIndex(opts.from, 0),
|
||||
to = getIndex(opts.to, length - 1);
|
||||
|
||||
if (from > to) {
|
||||
if (closed) {
|
||||
from -= length;
|
||||
|
@ -2048,7 +2050,9 @@ new function() { // Scope for drawing
|
|||
// performance.
|
||||
|
||||
function drawHandles(ctx, segments, matrix, size) {
|
||||
var half = size / 2;
|
||||
var half = size / 2,
|
||||
coords = new Array(6),
|
||||
pX, pY;
|
||||
|
||||
function drawHandle(index) {
|
||||
var hX = coords[index],
|
||||
|
@ -2064,13 +2068,12 @@ new function() { // Scope for drawing
|
|||
}
|
||||
}
|
||||
|
||||
var coords = new Array(6);
|
||||
for (var i = 0, l = segments.length; i < l; i++) {
|
||||
var segment = segments[i];
|
||||
var segment = segments[i],
|
||||
selection = segment._selection;
|
||||
segment._transformCoordinates(matrix, coords);
|
||||
var selection = segment._selection,
|
||||
pX = coords[0],
|
||||
pY = coords[1];
|
||||
pX = coords[0];
|
||||
pY = coords[1];
|
||||
if (selection & /*#=*/SegmentSelection.HANDLE_IN)
|
||||
drawHandle(2);
|
||||
if (selection & /*#=*/SegmentSelection.HANDLE_OUT)
|
||||
|
|
|
@ -19,7 +19,8 @@ new function() {
|
|||
// objects, dealing with baseVal, and item lists.
|
||||
// index is option, and if passed, causes a lookup in a list.
|
||||
|
||||
var rootSize;
|
||||
var definitions = {},
|
||||
rootSize;
|
||||
|
||||
function getValue(node, name, isString, allowNull, allowPercent) {
|
||||
// Interpret value as number. Never return NaN, but 0 instead.
|
||||
|
@ -547,7 +548,6 @@ new function() {
|
|||
return item;
|
||||
}
|
||||
|
||||
var definitions = {};
|
||||
function getDefinition(value) {
|
||||
// When url() comes from a style property, '#'' seems to be missing on
|
||||
// WebKit. We also get variations of quotes or no quotes, single or
|
||||
|
|
|
@ -1152,7 +1152,18 @@ new function() { // Injection scope for event handling on the browser
|
|||
fallbacks = {
|
||||
doubleclick: 'click',
|
||||
mousedrag: 'mousemove'
|
||||
};
|
||||
},
|
||||
// Various variables required by #_handleMouseEvent()
|
||||
wasInView = false,
|
||||
overView,
|
||||
downPoint,
|
||||
lastPoint,
|
||||
downItem,
|
||||
overItem,
|
||||
dragItem,
|
||||
clickItem,
|
||||
clickTime,
|
||||
dblClick;
|
||||
|
||||
// Returns true if event was prevented, false otherwise.
|
||||
function emitMouseEvent(obj, target, type, event, point, prevPoint,
|
||||
|
@ -1248,20 +1259,6 @@ new function() { // Injection scope for event handling on the browser
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Various variables required by #_handleMouseEvent()
|
||||
*/
|
||||
var downPoint,
|
||||
lastPoint,
|
||||
downItem,
|
||||
overItem,
|
||||
dragItem,
|
||||
clickItem,
|
||||
clickTime,
|
||||
dblClick,
|
||||
overView,
|
||||
wasInView = false;
|
||||
|
||||
return {
|
||||
_viewEvents: viewEvents,
|
||||
|
||||
|
|
Loading…
Reference in a new issue