diff options
author | nobuti <buti@nobuti.com> | 2018-10-26 19:00:17 +0200 |
---|---|---|
committer | nobuti <buti@nobuti.com> | 2018-10-26 19:00:17 +0200 |
commit | 9e9c9216faef1710bd191a3f9f8ca86f6aa16dba (patch) | |
tree | 662b116294e9264adb53c4ea2c3db3309de72ebc /dist/svg.js | |
parent | f968b09a42fb586f71b847c8d54be90309b46c8b (diff) | |
download | svg.js-9e9c9216faef1710bd191a3f9f8ca86f6aa16dba.tar.gz svg.js-9e9c9216faef1710bd191a3f9f8ca86f6aa16dba.zip |
Build
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 265 |
1 files changed, 118 insertions, 147 deletions
diff --git a/dist/svg.js b/dist/svg.js index f78ec03..b761f0a 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,31 +6,31 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Thu Oct 18 2018 11:49:16 GMT+0200 (GMT+02:00) +* BUILT: Fri Oct 26 2018 18:56:01 GMT+0200 (CEST) */; -
-(function(root, factory) {
- /* istanbul ignore next */
- if (typeof define === 'function' && define.amd) {
- define(function(){
- return factory(root, root.document)
- })
- } else if (typeof exports === 'object') {
- module.exports = root.document ? factory(root, root.document) : function(w){ return factory(w, w.document) }
- } else {
- root.SVG = factory(root, root.document)
- }
-}(typeof window !== "undefined" ? window : this, function(window, document) {
-
-// Check that our browser supports svg
-var supported = !! document.createElementNS &&
- !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect
-
-// If we don't support svg, just exit without doing anything
-if (!supported)
- return {supported: false}
-
-// Otherwise, the library will be here
+ +(function(root, factory) { + /* istanbul ignore next */ + if (typeof define === 'function' && define.amd) { + define(function(){ + return factory(root, root.document) + }) + } else if (typeof exports === 'object') { + module.exports = root.document ? factory(root, root.document) : function(w){ return factory(w, w.document) } + } else { + root.SVG = factory(root, root.document) + } +}(typeof window !== "undefined" ? window : this, function(window, document) { + +// Check that our browser supports svg +var supported = !! document.createElementNS && + !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect + +// If we don't support svg, just exit without doing anything +if (!supported) + return {supported: false} + +// Otherwise, the library will be here "use strict"; function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } @@ -336,33 +336,33 @@ SVG.Queue = SVG.invent({ }); /* globals fullHex, compToHex */ -/*
-
-Color {
- constructor (a, b, c, space) {
- space: 'hsl'
- a: 30
- b: 20
- c: 10
- },
-
- toRgb () { return new Color in rgb space }
- toHsl () { return new Color in hsl space }
- toLab () { return new Color in lab space }
-
- toArray () { [space, a, b, c] }
- fromArray () { convert it back }
-}
-
-// Conversions aren't always exact because of monitor profiles etc...
-new Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()
-new Color(100, 100, 100, [space])
-new Color('hsl(30, 20, 10)')
-
-// Sugar
-SVG.rgb(30, 20, 50).lab()
-SVG.hsl()
-SVG.lab('rgb(100, 100, 100)')
+/* + +Color { + constructor (a, b, c, space) { + space: 'hsl' + a: 30 + b: 20 + c: 10 + }, + + toRgb () { return new Color in rgb space } + toHsl () { return new Color in hsl space } + toLab () { return new Color in lab space } + + toArray () { [space, a, b, c] } + fromArray () { convert it back } +} + +// Conversions aren't always exact because of monitor profiles etc... +new Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl() +new Color(100, 100, 100, [space]) +new Color('hsl(30, 20, 10)') + +// Sugar +SVG.rgb(30, 20, 50).lab() +SVG.hsl() +SVG.lab('rgb(100, 100, 100)') */ // Module for color convertions @@ -1021,16 +1021,6 @@ SVG.Number = SVG.invent({ number = new SVG.Number(number); return new SVG.Number(this / number, this.unit || number.unit); }, - // Convert to different unit - to: function to(unit) { - var number = new SVG.Number(this); - - if (typeof unit === 'string') { - number.unit = unit; - } - - return number; - }, // Make number morphable morph: function morph(number) { this.destination = new SVG.Number(number); @@ -1309,7 +1299,7 @@ SVG.Element = SVG.invent({ svg: function svg(_svg) { var well, len; // act as a setter if svg is given - if (_svg && this instanceof SVG.Parent) { + if (typeof _svg === 'string' && this instanceof SVG.Parent) { // create temporary holder well = document.createElementNS(SVG.ns, 'svg'); // dump raw svg @@ -1320,7 +1310,19 @@ SVG.Element = SVG.invent({ } // otherwise act as a getter } else { - // write svgjs data to the dom + if (typeof _svg === 'function') { + well = _svg(this); + + if (well instanceof SVG.Element) { + return well.svg(); + } + + if (typeof well === 'boolean' && !well) { + return null; + } + } // write svgjs data to the dom + + this.writeDataToDom(); return this.node.outerHTML; } @@ -1869,9 +1871,9 @@ SVG.Matrix = SVG.invent({ }, // Get current screen matrix screenCTM: function screenCTM() { - /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537
- This is needed because FF does not return the transformation matrix
- for the inner coordinate system when getScreenCTM() is called on nested svgs.
+ /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. However all other Browsers do that */ if (this instanceof SVG.Doc && !this.isRoot()) { var rect = this.rect(1, 1); @@ -4442,8 +4444,7 @@ SVG.Runner = SVG.invent({ this.enabled = true; this._time = 0; - this._last = 0; - this.tags = {}; // Save transforms applied to this runner + this._last = 0; // Save transforms applied to this runner this.transforms = new SVG.Matrix(); this.transformId = 1; // Looping variables @@ -4466,11 +4467,11 @@ SVG.Runner = SVG.invent({ } }, extend: { - /*
- Runner Definitions
- ==================
- These methods help us define the runtime behaviour of the Runner or they
- help us make new runners from the current runner
+ /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner */ element: function element(_element3) { if (_element3 == null) return this._element; @@ -4533,10 +4534,10 @@ SVG.Runner = SVG.invent({ return this.animate(0, _delay); }, - /*
- Basic Functionality
- ===================
- These methods allow us to attach basic functions to the runner directly
+ /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly */ queue: function queue(initFn, runFn, isTransform) { this._queue.push({ @@ -4558,10 +4559,10 @@ SVG.Runner = SVG.invent({ return this.on('finish', fn); }, - /*
- Runner animation methods
- ========================
- Control how the animation plays
+ /* + Runner animation methods + ======================== + Control how the animation plays */ time: function time(_time) { if (_time == null) { @@ -4601,11 +4602,11 @@ SVG.Runner = SVG.invent({ var position; if (p == null) { - /*
- This function converts a time to a position in the range [0, 1]
- The full explanation can be found in this desmos demonstration
- https://www.desmos.com/calculator/u4fbavgche
- The logic is slightly simplified here because we can use booleans
+ /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans */ // Figure out the value without thinking about the start or end time var f = function f(x) { @@ -4696,40 +4697,10 @@ SVG.Runner = SVG.invent({ return this; }, - /*
- Runner Management
- =================
- Functions that are used to help index the runner
- */ - tag: function tag(name) { - // Act as a getter to get all of the tags on this object - if (name == null) return Object.keys(this.tags); // Add all of the tags to the object directly - - name = Array.isArray(name) ? name : [name]; - - for (var i = name.length; i--;) { - this.tags[name[i]] = true; - } - - return this; - }, - untag: function untag(name) { - name = Array.isArray(name) ? name : [name]; - - for (var i = name.length; i--;) { - delete this.tags[name[i]]; - } - - return this; - }, - getEventTarget: function getEventTarget() { - return this._dispatcher; - }, - - /*
- Private Methods
- ===============
- Methods that shouldn't be used externally
+ /* + Private Methods + =============== + Methods that shouldn't be used externally */ // Save a morpher to the morpher list so that we can retarget it later _rememberMorpher: function _rememberMorpher(method, morpher) { @@ -5034,8 +5005,8 @@ SVG.extend(SVG.Runner, { return this; }, - /**
- ** absolute transformations
+ /** + ** absolute transformations **/ // // M v -----|-----(D M v = F v)------|-----> T v @@ -5253,14 +5224,14 @@ SVG.extend(SVG.Runner, { return this._queueObject('plot', new this._element.MorphArray(a)); - /*
- var morpher = this._element.morphArray().to(a)
- this.queue(function () {
- morpher.from(this._element.array())
- }, function (pos) {
- this._element.plot(morpher.at(pos))
- })
- return this
+ /* + var morpher = this._element.morphArray().to(a) + this.queue(function () { + morpher.from(this._element.array()) + }, function (pos) { + this._element.plot(morpher.at(pos)) + }) + return this */ }, // Add leading method @@ -5344,8 +5315,8 @@ SVG.Timeline = SVG.invent({ return this._dispatcher; }, - /**
- *
+ /** + * */ // schedules a runner on the timeline schedule: function schedule(runner, delay, when) { @@ -5560,10 +5531,10 @@ SVG.Timeline = SVG.invent({ // finished: Whether or not we are finished // } -/***
-Base Class
-==========
-The base stepper class that will be
+/*** +Base Class +========== +The base stepper class that will be ***/ function makeSetterGetter(k, f) { @@ -5578,9 +5549,9 @@ function makeSetterGetter(k, f) { SVG.Stepper = SVG.invent({ create: function create() {} }); -/***
-Easing Functions
-================
+/*** +Easing Functions +================ ***/ SVG.Ease = SVG.invent({ @@ -5619,9 +5590,9 @@ SVG.easing = { return function (t) {// TODO: FINISH }; } - /***
- Controller Types
- ================
+ /*** + Controller Types + ================ ***/ }; @@ -5719,9 +5690,9 @@ SVG.PID = SVG.invent({ i: makeSetterGetter('I'), d: makeSetterGetter('D') } -});
-
-return SVG
-
-}));
+}); + +return SVG + +})); //# sourceMappingURL=svg.js.map |