2013-05-27 15:48:58 -04:00
|
|
|
/*
|
|
|
|
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
|
|
* http://paperjs.org/
|
|
|
|
*
|
2014-01-03 19:47:16 -05:00
|
|
|
* Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey
|
|
|
|
* http://scratchdisk.com/ & http://jonathanpuckey.com/
|
2013-05-27 15:48:58 -04:00
|
|
|
*
|
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2013-06-27 06:58:14 -04:00
|
|
|
// First add Base and a couple of other objects that are not automatically
|
|
|
|
// exported to exports (Numerical, Key, etc), then inject all exports into
|
2013-06-24 07:40:07 -04:00
|
|
|
// PaperScope, and create the initial paper object, all in one statement:
|
2013-11-29 14:26:38 -05:00
|
|
|
/*#*/ if (__options.environment == 'browser') {
|
2013-06-27 16:49:04 -04:00
|
|
|
|
2013-11-28 16:20:00 -05:00
|
|
|
paper = new (PaperScope.inject(new Base(Base.exports, {
|
2013-05-30 17:37:04 -04:00
|
|
|
// Mark fields as enumeralbe so PaperScope.inject can pick them up
|
|
|
|
enumerable: true,
|
|
|
|
Base: Base,
|
2013-06-24 07:40:07 -04:00
|
|
|
Numerical: Numerical,
|
|
|
|
DomElement: DomElement,
|
2013-06-27 06:58:14 -04:00
|
|
|
DomEvent: DomEvent,
|
2013-11-05 20:22:24 -05:00
|
|
|
Http: Http,
|
2013-06-27 06:58:14 -04:00
|
|
|
Key: Key
|
2013-05-27 21:28:35 -04:00
|
|
|
})))();
|
2013-06-24 07:40:35 -04:00
|
|
|
|
|
|
|
// Support AMD (e.g. require.js)
|
2013-08-14 17:26:23 -04:00
|
|
|
// Use named module AMD syntax since there are other unnamed calls to define()
|
|
|
|
// inside the built library (from inlined Acorn / Esprima) that apparently
|
|
|
|
// confuse the require.js optimizer.
|
2013-06-24 07:40:35 -04:00
|
|
|
if (typeof define === 'function' && define.amd)
|
2013-08-14 17:26:23 -04:00
|
|
|
define('paper', paper);
|
2013-06-27 16:49:04 -04:00
|
|
|
|
2013-11-29 14:26:38 -05:00
|
|
|
/*#*/ } else if (__options.environment == 'node') {
|
2013-06-27 16:49:04 -04:00
|
|
|
|
2013-11-28 16:20:00 -05:00
|
|
|
paper = new (PaperScope.inject(new Base(Base.exports, {
|
2013-06-27 16:49:04 -04:00
|
|
|
// Mark fields as enumeralbe so PaperScope.inject can pick them up
|
|
|
|
enumerable: true,
|
|
|
|
Base: Base,
|
|
|
|
Numerical: Numerical,
|
|
|
|
DomElement: DomElement,
|
|
|
|
// Export dom/node.js stuff too
|
|
|
|
XMLSerializer: XMLSerializer,
|
|
|
|
DOMParser: DOMParser,
|
|
|
|
Canvas: Canvas
|
|
|
|
})))();
|
|
|
|
|
2013-06-27 17:31:03 -04:00
|
|
|
// Export the paper scope.
|
|
|
|
module.exports = paper;
|
|
|
|
|
2013-11-29 14:26:38 -05:00
|
|
|
/*#*/ } // __options.environment == 'node'
|