Prebuilt module for commit 7cf844886f

This commit is contained in:
Paper.js Bot 2016-04-05 06:30:11 +00:00
parent 41924fe587
commit 05cf664ae2
5 changed files with 79 additions and 52 deletions

View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Apr 4 17:55:43 2016 -0700 * Date: Mon Apr 4 23:26:43 2016 -0700
* *
*** ***
* *
@ -829,6 +829,11 @@ var PaperScope = Base.extend({
delete PaperScope._scopes[this._id]; delete PaperScope._scopes[this._id];
}, },
resolvePath: function(url) {
return this.agent.node && !/^(?:[a-z]+:)?\/\//i.test(url)
? 'file://' + require('path').resolve(url) : url;
},
statics: new function() { statics: new function() {
function handleAttribute(name) { function handleAttribute(name) {
name += 'Attribute'; name += 'Attribute';
@ -4877,10 +4882,12 @@ var Raster = Item.extend({
initialize: function Raster(object, position) { initialize: function Raster(object, position) {
if (!this._initialize(object, if (!this._initialize(object,
position !== undefined && Point.read(arguments, 1))) { position !== undefined && Point.read(arguments, 1))) {
if (typeof object === 'string') { var image = typeof object === 'string'
this.setSource(object); ? document.getElementById(object) : object;
if (image) {
this.setImage(image);
} else { } else {
this.setImage(object); this.setSource(object);
} }
} }
if (!this._size) { if (!this._size) {
@ -5048,23 +5055,24 @@ var Raster = Item.extend({
}, },
setSource: function(src) { setSource: function(src) {
var crossOrigin = this._crossOrigin, image = new window.Image();
image = document.getElementById(src) || new window.Image(); image.src = paper.resolvePath(src);
var crossOrigin = this._crossOrigin;
if (crossOrigin) if (crossOrigin)
image.crossOrigin = crossOrigin; image.crossOrigin = crossOrigin;
if (!image.src)
image.src = src;
this.setImage(image); this.setImage(image);
}, },
getCrossOrigin: function() { getCrossOrigin: function() {
return this._image && this._image.crossOrigin || this._crossOrigin || ''; var image = this._image;
return image && image.crossOrigin || this._crossOrigin || '';
}, },
setCrossOrigin: function(crossOrigin) { setCrossOrigin: function(crossOrigin) {
this._crossOrigin = crossOrigin; this._crossOrigin = crossOrigin;
if (this._image) var image = this._image;
this._image.crossOrigin = crossOrigin; if (image)
image.crossOrigin = crossOrigin;
}, },
getElement: function() { getElement: function() {
@ -12735,7 +12743,8 @@ var Tool = PaperScopeItem.extend({
var Http = { var Http = {
request: function(options) { request: function(options) {
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();
xhr.open((options.method || 'get').toUpperCase(), options.url, xhr.open((options.method || 'get').toUpperCase(),
paper.resolvePath(options.url),
Base.pick(options.async, true)); Base.pick(options.async, true));
if (options.mimeType) if (options.mimeType)
xhr.overrideMimeType(options.mimeType); xhr.overrideMimeType(options.mimeType);

33
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Apr 4 17:55:43 2016 -0700 * Date: Mon Apr 4 23:26:43 2016 -0700
* *
*** ***
* *
@ -829,6 +829,11 @@ var PaperScope = Base.extend({
delete PaperScope._scopes[this._id]; delete PaperScope._scopes[this._id];
}, },
resolvePath: function(url) {
return this.agent.node && !/^(?:[a-z]+:)?\/\//i.test(url)
? 'file://' + require('path').resolve(url) : url;
},
statics: new function() { statics: new function() {
function handleAttribute(name) { function handleAttribute(name) {
name += 'Attribute'; name += 'Attribute';
@ -4877,10 +4882,12 @@ var Raster = Item.extend({
initialize: function Raster(object, position) { initialize: function Raster(object, position) {
if (!this._initialize(object, if (!this._initialize(object,
position !== undefined && Point.read(arguments, 1))) { position !== undefined && Point.read(arguments, 1))) {
if (typeof object === 'string') { var image = typeof object === 'string'
this.setSource(object); ? document.getElementById(object) : object;
if (image) {
this.setImage(image);
} else { } else {
this.setImage(object); this.setSource(object);
} }
} }
if (!this._size) { if (!this._size) {
@ -5048,23 +5055,24 @@ var Raster = Item.extend({
}, },
setSource: function(src) { setSource: function(src) {
var crossOrigin = this._crossOrigin, image = new window.Image();
image = document.getElementById(src) || new window.Image(); image.src = paper.resolvePath(src);
var crossOrigin = this._crossOrigin;
if (crossOrigin) if (crossOrigin)
image.crossOrigin = crossOrigin; image.crossOrigin = crossOrigin;
if (!image.src)
image.src = src;
this.setImage(image); this.setImage(image);
}, },
getCrossOrigin: function() { getCrossOrigin: function() {
return this._image && this._image.crossOrigin || this._crossOrigin || ''; var image = this._image;
return image && image.crossOrigin || this._crossOrigin || '';
}, },
setCrossOrigin: function(crossOrigin) { setCrossOrigin: function(crossOrigin) {
this._crossOrigin = crossOrigin; this._crossOrigin = crossOrigin;
if (this._image) var image = this._image;
this._image.crossOrigin = crossOrigin; if (image)
image.crossOrigin = crossOrigin;
}, },
getElement: function() { getElement: function() {
@ -12735,7 +12743,8 @@ var Tool = PaperScopeItem.extend({
var Http = { var Http = {
request: function(options) { request: function(options) {
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();
xhr.open((options.method || 'get').toUpperCase(), options.url, xhr.open((options.method || 'get').toUpperCase(),
paper.resolvePath(options.url),
Base.pick(options.async, true)); Base.pick(options.async, true));
if (options.mimeType) if (options.mimeType)
xhr.overrideMimeType(options.mimeType); xhr.overrideMimeType(options.mimeType);

File diff suppressed because one or more lines are too long

33
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Apr 4 17:55:43 2016 -0700 * Date: Mon Apr 4 23:26:43 2016 -0700
* *
*** ***
* *
@ -829,6 +829,11 @@ var PaperScope = Base.extend({
delete PaperScope._scopes[this._id]; delete PaperScope._scopes[this._id];
}, },
resolvePath: function(url) {
return this.agent.node && !/^(?:[a-z]+:)?\/\//i.test(url)
? 'file://' + require('path').resolve(url) : url;
},
statics: new function() { statics: new function() {
function handleAttribute(name) { function handleAttribute(name) {
name += 'Attribute'; name += 'Attribute';
@ -4877,10 +4882,12 @@ var Raster = Item.extend({
initialize: function Raster(object, position) { initialize: function Raster(object, position) {
if (!this._initialize(object, if (!this._initialize(object,
position !== undefined && Point.read(arguments, 1))) { position !== undefined && Point.read(arguments, 1))) {
if (typeof object === 'string') { var image = typeof object === 'string'
this.setSource(object); ? document.getElementById(object) : object;
if (image) {
this.setImage(image);
} else { } else {
this.setImage(object); this.setSource(object);
} }
} }
if (!this._size) { if (!this._size) {
@ -5048,23 +5055,24 @@ var Raster = Item.extend({
}, },
setSource: function(src) { setSource: function(src) {
var crossOrigin = this._crossOrigin, image = new window.Image();
image = document.getElementById(src) || new window.Image(); image.src = paper.resolvePath(src);
var crossOrigin = this._crossOrigin;
if (crossOrigin) if (crossOrigin)
image.crossOrigin = crossOrigin; image.crossOrigin = crossOrigin;
if (!image.src)
image.src = src;
this.setImage(image); this.setImage(image);
}, },
getCrossOrigin: function() { getCrossOrigin: function() {
return this._image && this._image.crossOrigin || this._crossOrigin || ''; var image = this._image;
return image && image.crossOrigin || this._crossOrigin || '';
}, },
setCrossOrigin: function(crossOrigin) { setCrossOrigin: function(crossOrigin) {
this._crossOrigin = crossOrigin; this._crossOrigin = crossOrigin;
if (this._image) var image = this._image;
this._image.crossOrigin = crossOrigin; if (image)
image.crossOrigin = crossOrigin;
}, },
getElement: function() { getElement: function() {
@ -12735,7 +12743,8 @@ var Tool = PaperScopeItem.extend({
var Http = { var Http = {
request: function(options) { request: function(options) {
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();
xhr.open((options.method || 'get').toUpperCase(), options.url, xhr.open((options.method || 'get').toUpperCase(),
paper.resolvePath(options.url),
Base.pick(options.async, true)); Base.pick(options.async, true));
if (options.mimeType) if (options.mimeType)
xhr.overrideMimeType(options.mimeType); xhr.overrideMimeType(options.mimeType);

File diff suppressed because one or more lines are too long