mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Prebuilt module for commit da216aa581
This commit is contained in:
parent
27b61b9a4e
commit
237d8db30d
5 changed files with 98 additions and 129 deletions
68
dist/docs/assets/js/paper.js
vendored
68
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Mon Feb 8 14:17:16 2016 +0100
|
* Date: Tue Feb 9 09:59:19 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2562,10 +2562,12 @@ var Project = PaperScopeItem.extend({
|
||||||
|
|
||||||
_changed: function(flags, item) {
|
_changed: function(flags, item) {
|
||||||
if (flags & 1) {
|
if (flags & 1) {
|
||||||
this._needsUpdate = true;
|
|
||||||
var view = this._view;
|
var view = this._view;
|
||||||
if (view && !view._requested && view._autoUpdate)
|
if (view) {
|
||||||
view.requestUpdate();
|
view._needsUpdate = true;
|
||||||
|
if (!view._requested && view._autoUpdate)
|
||||||
|
view.requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var changes = this._changes;
|
var changes = this._changes;
|
||||||
if (changes && item) {
|
if (changes && item) {
|
||||||
|
@ -11320,40 +11322,20 @@ DomEvent.requestAnimationFrame = new function() {
|
||||||
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
||||||
requested = false,
|
requested = false,
|
||||||
callbacks = [],
|
callbacks = [],
|
||||||
focused = true,
|
|
||||||
timer;
|
timer;
|
||||||
|
|
||||||
DomEvent.add(window, {
|
|
||||||
focus: function() {
|
|
||||||
focused = true;
|
|
||||||
},
|
|
||||||
blur: function() {
|
|
||||||
focused = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleCallbacks() {
|
function handleCallbacks() {
|
||||||
for (var i = callbacks.length - 1; i >= 0; i--) {
|
var functions = callbacks;
|
||||||
var entry = callbacks[i],
|
callbacks = [];
|
||||||
func = entry[0],
|
for (var i = 0, l = functions.length; i < l; i++)
|
||||||
el = entry[1];
|
functions[i]();
|
||||||
if (!el || (PaperScope.getAttribute(el, 'keepalive') == 'true'
|
requested = nativeRequest && callbacks.length;
|
||||||
|| focused) && DomElement.isInView(el)) {
|
if (requested)
|
||||||
callbacks.splice(i, 1);
|
nativeRequest(handleCallbacks);
|
||||||
func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nativeRequest) {
|
|
||||||
if (callbacks.length) {
|
|
||||||
nativeRequest(handleCallbacks);
|
|
||||||
} else {
|
|
||||||
requested = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(callback, element) {
|
return function(callback) {
|
||||||
callbacks.push([callback, element]);
|
callbacks.push(callback);
|
||||||
if (nativeRequest) {
|
if (nativeRequest) {
|
||||||
if (!requested) {
|
if (!requested) {
|
||||||
nativeRequest(handleCallbacks);
|
nativeRequest(handleCallbacks);
|
||||||
|
@ -11439,6 +11421,7 @@ var View = Base.extend(Emitter, {
|
||||||
this._frameItemCount = 0;
|
this._frameItemCount = 0;
|
||||||
this._itemEvents = { native: {}, virtual: {} };
|
this._itemEvents = { native: {}, virtual: {} };
|
||||||
this._autoUpdate = !paper.agent.node;
|
this._autoUpdate = !paper.agent.node;
|
||||||
|
this._needsUpdate = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function() {
|
remove: function() {
|
||||||
|
@ -11505,11 +11488,16 @@ var View = Base.extend(Emitter, {
|
||||||
that._requested = false;
|
that._requested = false;
|
||||||
if (that._animate) {
|
if (that._animate) {
|
||||||
that.requestUpdate();
|
that.requestUpdate();
|
||||||
that._handleFrame();
|
var element = that._element;
|
||||||
|
if ((!DomElement.getPrefixed(document, 'hidden')
|
||||||
|
|| PaperScope.getAttribute(element, 'keepalive')
|
||||||
|
=== 'true') && DomElement.isInView(element)) {
|
||||||
|
that._handleFrame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (that._autoUpdate)
|
if (that._autoUpdate)
|
||||||
that.update();
|
that.update();
|
||||||
}, this._element);
|
});
|
||||||
this._requested = true;
|
this._requested = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12066,6 +12054,7 @@ var CanvasView = View.extend({
|
||||||
this._pixelRatio = deviceRatio / backingStoreRatio;
|
this._pixelRatio = deviceRatio / backingStoreRatio;
|
||||||
}
|
}
|
||||||
View.call(this, project, canvas);
|
View.call(this, project, canvas);
|
||||||
|
this._needsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function remove() {
|
remove: function remove() {
|
||||||
|
@ -12117,14 +12106,14 @@ var CanvasView = View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
var project = this._project;
|
if (!this._needsUpdate)
|
||||||
if (!project || !project._needsUpdate)
|
|
||||||
return false;
|
return false;
|
||||||
var ctx = this._context,
|
var project = this._project,
|
||||||
|
ctx = this._context,
|
||||||
size = this._viewSize;
|
size = this._viewSize;
|
||||||
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
||||||
project.draw(ctx, this._matrix, this._pixelRatio);
|
project.draw(ctx, this._matrix, this._pixelRatio);
|
||||||
project._needsUpdate = false;
|
this._needsUpdate = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14129,6 +14118,7 @@ Base.exports.PaperScript = (function() {
|
||||||
});
|
});
|
||||||
if (res.onFrame)
|
if (res.onFrame)
|
||||||
view.setOnFrame(res.onFrame);
|
view.setOnFrame(res.onFrame);
|
||||||
|
view.requestUpdate();
|
||||||
}
|
}
|
||||||
return compiled;
|
return compiled;
|
||||||
}
|
}
|
||||||
|
|
67
dist/paper-core.js
vendored
67
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Mon Feb 8 14:17:16 2016 +0100
|
* Date: Tue Feb 9 09:59:19 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2562,10 +2562,12 @@ var Project = PaperScopeItem.extend({
|
||||||
|
|
||||||
_changed: function(flags, item) {
|
_changed: function(flags, item) {
|
||||||
if (flags & 1) {
|
if (flags & 1) {
|
||||||
this._needsUpdate = true;
|
|
||||||
var view = this._view;
|
var view = this._view;
|
||||||
if (view && !view._requested && view._autoUpdate)
|
if (view) {
|
||||||
view.requestUpdate();
|
view._needsUpdate = true;
|
||||||
|
if (!view._requested && view._autoUpdate)
|
||||||
|
view.requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var changes = this._changes;
|
var changes = this._changes;
|
||||||
if (changes && item) {
|
if (changes && item) {
|
||||||
|
@ -11320,40 +11322,20 @@ DomEvent.requestAnimationFrame = new function() {
|
||||||
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
||||||
requested = false,
|
requested = false,
|
||||||
callbacks = [],
|
callbacks = [],
|
||||||
focused = true,
|
|
||||||
timer;
|
timer;
|
||||||
|
|
||||||
DomEvent.add(window, {
|
|
||||||
focus: function() {
|
|
||||||
focused = true;
|
|
||||||
},
|
|
||||||
blur: function() {
|
|
||||||
focused = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleCallbacks() {
|
function handleCallbacks() {
|
||||||
for (var i = callbacks.length - 1; i >= 0; i--) {
|
var functions = callbacks;
|
||||||
var entry = callbacks[i],
|
callbacks = [];
|
||||||
func = entry[0],
|
for (var i = 0, l = functions.length; i < l; i++)
|
||||||
el = entry[1];
|
functions[i]();
|
||||||
if (!el || (PaperScope.getAttribute(el, 'keepalive') == 'true'
|
requested = nativeRequest && callbacks.length;
|
||||||
|| focused) && DomElement.isInView(el)) {
|
if (requested)
|
||||||
callbacks.splice(i, 1);
|
nativeRequest(handleCallbacks);
|
||||||
func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nativeRequest) {
|
|
||||||
if (callbacks.length) {
|
|
||||||
nativeRequest(handleCallbacks);
|
|
||||||
} else {
|
|
||||||
requested = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(callback, element) {
|
return function(callback) {
|
||||||
callbacks.push([callback, element]);
|
callbacks.push(callback);
|
||||||
if (nativeRequest) {
|
if (nativeRequest) {
|
||||||
if (!requested) {
|
if (!requested) {
|
||||||
nativeRequest(handleCallbacks);
|
nativeRequest(handleCallbacks);
|
||||||
|
@ -11439,6 +11421,7 @@ var View = Base.extend(Emitter, {
|
||||||
this._frameItemCount = 0;
|
this._frameItemCount = 0;
|
||||||
this._itemEvents = { native: {}, virtual: {} };
|
this._itemEvents = { native: {}, virtual: {} };
|
||||||
this._autoUpdate = !paper.agent.node;
|
this._autoUpdate = !paper.agent.node;
|
||||||
|
this._needsUpdate = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function() {
|
remove: function() {
|
||||||
|
@ -11505,11 +11488,16 @@ var View = Base.extend(Emitter, {
|
||||||
that._requested = false;
|
that._requested = false;
|
||||||
if (that._animate) {
|
if (that._animate) {
|
||||||
that.requestUpdate();
|
that.requestUpdate();
|
||||||
that._handleFrame();
|
var element = that._element;
|
||||||
|
if ((!DomElement.getPrefixed(document, 'hidden')
|
||||||
|
|| PaperScope.getAttribute(element, 'keepalive')
|
||||||
|
=== 'true') && DomElement.isInView(element)) {
|
||||||
|
that._handleFrame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (that._autoUpdate)
|
if (that._autoUpdate)
|
||||||
that.update();
|
that.update();
|
||||||
}, this._element);
|
});
|
||||||
this._requested = true;
|
this._requested = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12066,6 +12054,7 @@ var CanvasView = View.extend({
|
||||||
this._pixelRatio = deviceRatio / backingStoreRatio;
|
this._pixelRatio = deviceRatio / backingStoreRatio;
|
||||||
}
|
}
|
||||||
View.call(this, project, canvas);
|
View.call(this, project, canvas);
|
||||||
|
this._needsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function remove() {
|
remove: function remove() {
|
||||||
|
@ -12117,14 +12106,14 @@ var CanvasView = View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
var project = this._project;
|
if (!this._needsUpdate)
|
||||||
if (!project || !project._needsUpdate)
|
|
||||||
return false;
|
return false;
|
||||||
var ctx = this._context,
|
var project = this._project,
|
||||||
|
ctx = this._context,
|
||||||
size = this._viewSize;
|
size = this._viewSize;
|
||||||
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
||||||
project.draw(ctx, this._matrix, this._pixelRatio);
|
project.draw(ctx, this._matrix, this._pixelRatio);
|
||||||
project._needsUpdate = false;
|
this._needsUpdate = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
14
dist/paper-core.min.js
vendored
14
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
68
dist/paper-full.js
vendored
68
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Mon Feb 8 14:17:16 2016 +0100
|
* Date: Tue Feb 9 09:59:19 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2562,10 +2562,12 @@ var Project = PaperScopeItem.extend({
|
||||||
|
|
||||||
_changed: function(flags, item) {
|
_changed: function(flags, item) {
|
||||||
if (flags & 1) {
|
if (flags & 1) {
|
||||||
this._needsUpdate = true;
|
|
||||||
var view = this._view;
|
var view = this._view;
|
||||||
if (view && !view._requested && view._autoUpdate)
|
if (view) {
|
||||||
view.requestUpdate();
|
view._needsUpdate = true;
|
||||||
|
if (!view._requested && view._autoUpdate)
|
||||||
|
view.requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var changes = this._changes;
|
var changes = this._changes;
|
||||||
if (changes && item) {
|
if (changes && item) {
|
||||||
|
@ -11320,40 +11322,20 @@ DomEvent.requestAnimationFrame = new function() {
|
||||||
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
var nativeRequest = DomElement.getPrefixed(window, 'requestAnimationFrame'),
|
||||||
requested = false,
|
requested = false,
|
||||||
callbacks = [],
|
callbacks = [],
|
||||||
focused = true,
|
|
||||||
timer;
|
timer;
|
||||||
|
|
||||||
DomEvent.add(window, {
|
|
||||||
focus: function() {
|
|
||||||
focused = true;
|
|
||||||
},
|
|
||||||
blur: function() {
|
|
||||||
focused = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleCallbacks() {
|
function handleCallbacks() {
|
||||||
for (var i = callbacks.length - 1; i >= 0; i--) {
|
var functions = callbacks;
|
||||||
var entry = callbacks[i],
|
callbacks = [];
|
||||||
func = entry[0],
|
for (var i = 0, l = functions.length; i < l; i++)
|
||||||
el = entry[1];
|
functions[i]();
|
||||||
if (!el || (PaperScope.getAttribute(el, 'keepalive') == 'true'
|
requested = nativeRequest && callbacks.length;
|
||||||
|| focused) && DomElement.isInView(el)) {
|
if (requested)
|
||||||
callbacks.splice(i, 1);
|
nativeRequest(handleCallbacks);
|
||||||
func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nativeRequest) {
|
|
||||||
if (callbacks.length) {
|
|
||||||
nativeRequest(handleCallbacks);
|
|
||||||
} else {
|
|
||||||
requested = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(callback, element) {
|
return function(callback) {
|
||||||
callbacks.push([callback, element]);
|
callbacks.push(callback);
|
||||||
if (nativeRequest) {
|
if (nativeRequest) {
|
||||||
if (!requested) {
|
if (!requested) {
|
||||||
nativeRequest(handleCallbacks);
|
nativeRequest(handleCallbacks);
|
||||||
|
@ -11439,6 +11421,7 @@ var View = Base.extend(Emitter, {
|
||||||
this._frameItemCount = 0;
|
this._frameItemCount = 0;
|
||||||
this._itemEvents = { native: {}, virtual: {} };
|
this._itemEvents = { native: {}, virtual: {} };
|
||||||
this._autoUpdate = !paper.agent.node;
|
this._autoUpdate = !paper.agent.node;
|
||||||
|
this._needsUpdate = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function() {
|
remove: function() {
|
||||||
|
@ -11505,11 +11488,16 @@ var View = Base.extend(Emitter, {
|
||||||
that._requested = false;
|
that._requested = false;
|
||||||
if (that._animate) {
|
if (that._animate) {
|
||||||
that.requestUpdate();
|
that.requestUpdate();
|
||||||
that._handleFrame();
|
var element = that._element;
|
||||||
|
if ((!DomElement.getPrefixed(document, 'hidden')
|
||||||
|
|| PaperScope.getAttribute(element, 'keepalive')
|
||||||
|
=== 'true') && DomElement.isInView(element)) {
|
||||||
|
that._handleFrame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (that._autoUpdate)
|
if (that._autoUpdate)
|
||||||
that.update();
|
that.update();
|
||||||
}, this._element);
|
});
|
||||||
this._requested = true;
|
this._requested = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12066,6 +12054,7 @@ var CanvasView = View.extend({
|
||||||
this._pixelRatio = deviceRatio / backingStoreRatio;
|
this._pixelRatio = deviceRatio / backingStoreRatio;
|
||||||
}
|
}
|
||||||
View.call(this, project, canvas);
|
View.call(this, project, canvas);
|
||||||
|
this._needsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function remove() {
|
remove: function remove() {
|
||||||
|
@ -12117,14 +12106,14 @@ var CanvasView = View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
var project = this._project;
|
if (!this._needsUpdate)
|
||||||
if (!project || !project._needsUpdate)
|
|
||||||
return false;
|
return false;
|
||||||
var ctx = this._context,
|
var project = this._project,
|
||||||
|
ctx = this._context,
|
||||||
size = this._viewSize;
|
size = this._viewSize;
|
||||||
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
|
||||||
project.draw(ctx, this._matrix, this._pixelRatio);
|
project.draw(ctx, this._matrix, this._pixelRatio);
|
||||||
project._needsUpdate = false;
|
this._needsUpdate = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14129,6 +14118,7 @@ Base.exports.PaperScript = (function() {
|
||||||
});
|
});
|
||||||
if (res.onFrame)
|
if (res.onFrame)
|
||||||
view.setOnFrame(res.onFrame);
|
view.setOnFrame(res.onFrame);
|
||||||
|
view.requestUpdate();
|
||||||
}
|
}
|
||||||
return compiled;
|
return compiled;
|
||||||
}
|
}
|
||||||
|
|
10
dist/paper-full.min.js
vendored
10
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue