pathseg-rails 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/pathseg-rails.rb +8 -0
- data/lib/pathseg-rails/version.rb +5 -0
- data/pathseg-rails.gemspec +24 -0
- data/vendor/assets/javascripts/pathseg.js +815 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d28d08cc095604a2abe617469bb6d14262e99725
|
4
|
+
data.tar.gz: b04da4075c67d1956a72fc612dee6a43adaefa28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9aa983c797ff3cae7bba3b15666d1f69528dc29f3e236c11f644f4cd3d9c06b0ea805d8fa0eca4f3fec19913820ca6280dfcbc6d86db0c4b1b4e8748c1b5bf3
|
7
|
+
data.tar.gz: 12d154c0eb415c4edfbcd838e04d374e8b49da028b16859d16ec66bc3f44a30a04bc91a1069ed5058806f1e105f714ef66a652485dc537b57008aa358be9e7b0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 javimbk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Pathseg::Rails
|
2
|
+
|
3
|
+
Simple gem that provides pathseg.js that can be found on [progers' repository](https://github.com/progers/pathseg).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'pathseg-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install pathseg-rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Add to `application.js`:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
//= require pathseg
|
27
|
+
```
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Feel free to open an issue if something's not working right, or if by any chance I don't have the up-to-date version of the library.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pathseg-rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pathseg-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pathseg-rails"
|
8
|
+
spec.version = Pathseg::Rails::VERSION
|
9
|
+
spec.authors = ["javimbk"]
|
10
|
+
spec.email = ["javimbk@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A polyfill for SVG's SVGPathSeg and SVGPathSegList in Rails."
|
13
|
+
spec.description = "The gem provides pathseg.js by progers on your Rails project."
|
14
|
+
spec.homepage = "https://github.com/javimbk/pathseg-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = [ ]
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
@@ -0,0 +1,815 @@
|
|
1
|
+
// SVGPathSeg API polyfill
|
2
|
+
// https://github.com/progers/pathseg
|
3
|
+
//
|
4
|
+
// This is a drop-in replacement for the SVGPathSeg and SVGPathSegList APIs that were removed from
|
5
|
+
// SVG2 (https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html), including the latest spec
|
6
|
+
// changes which were implemented in Firefox 43 and Chrome 46.
|
7
|
+
|
8
|
+
(function() { "use strict";
|
9
|
+
if (!("SVGPathSeg" in window)) {
|
10
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSeg
|
11
|
+
window.SVGPathSeg = function(type, typeAsLetter, owningPathSegList) {
|
12
|
+
this.pathSegType = type;
|
13
|
+
this.pathSegTypeAsLetter = typeAsLetter;
|
14
|
+
this._owningPathSegList = owningPathSegList;
|
15
|
+
}
|
16
|
+
|
17
|
+
SVGPathSeg.prototype.classname = "SVGPathSeg";
|
18
|
+
|
19
|
+
SVGPathSeg.PATHSEG_UNKNOWN = 0;
|
20
|
+
SVGPathSeg.PATHSEG_CLOSEPATH = 1;
|
21
|
+
SVGPathSeg.PATHSEG_MOVETO_ABS = 2;
|
22
|
+
SVGPathSeg.PATHSEG_MOVETO_REL = 3;
|
23
|
+
SVGPathSeg.PATHSEG_LINETO_ABS = 4;
|
24
|
+
SVGPathSeg.PATHSEG_LINETO_REL = 5;
|
25
|
+
SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS = 6;
|
26
|
+
SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL = 7;
|
27
|
+
SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS = 8;
|
28
|
+
SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL = 9;
|
29
|
+
SVGPathSeg.PATHSEG_ARC_ABS = 10;
|
30
|
+
SVGPathSeg.PATHSEG_ARC_REL = 11;
|
31
|
+
SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS = 12;
|
32
|
+
SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL = 13;
|
33
|
+
SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS = 14;
|
34
|
+
SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL = 15;
|
35
|
+
SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16;
|
36
|
+
SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;
|
37
|
+
SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
|
38
|
+
SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
|
39
|
+
|
40
|
+
// Notify owning PathSegList on any changes so they can be synchronized back to the path element.
|
41
|
+
SVGPathSeg.prototype._segmentChanged = function() {
|
42
|
+
if (this._owningPathSegList)
|
43
|
+
this._owningPathSegList.segmentChanged(this);
|
44
|
+
}
|
45
|
+
|
46
|
+
window.SVGPathSegClosePath = function(owningPathSegList) {
|
47
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CLOSEPATH, "z", owningPathSegList);
|
48
|
+
}
|
49
|
+
SVGPathSegClosePath.prototype = Object.create(SVGPathSeg.prototype);
|
50
|
+
SVGPathSegClosePath.prototype.toString = function() { return "[object SVGPathSegClosePath]"; }
|
51
|
+
SVGPathSegClosePath.prototype._asPathString = function() { return this.pathSegTypeAsLetter; }
|
52
|
+
SVGPathSegClosePath.prototype.clone = function() { return new SVGPathSegClosePath(undefined); }
|
53
|
+
|
54
|
+
window.SVGPathSegMovetoAbs = function(owningPathSegList, x, y) {
|
55
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_MOVETO_ABS, "M", owningPathSegList);
|
56
|
+
this._x = x;
|
57
|
+
this._y = y;
|
58
|
+
}
|
59
|
+
SVGPathSegMovetoAbs.prototype = Object.create(SVGPathSeg.prototype);
|
60
|
+
SVGPathSegMovetoAbs.prototype.toString = function() { return "[object SVGPathSegMovetoAbs]"; }
|
61
|
+
SVGPathSegMovetoAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
62
|
+
SVGPathSegMovetoAbs.prototype.clone = function() { return new SVGPathSegMovetoAbs(undefined, this._x, this._y); }
|
63
|
+
Object.defineProperty(SVGPathSegMovetoAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
64
|
+
Object.defineProperty(SVGPathSegMovetoAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
65
|
+
|
66
|
+
window.SVGPathSegMovetoRel = function(owningPathSegList, x, y) {
|
67
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_MOVETO_REL, "m", owningPathSegList);
|
68
|
+
this._x = x;
|
69
|
+
this._y = y;
|
70
|
+
}
|
71
|
+
SVGPathSegMovetoRel.prototype = Object.create(SVGPathSeg.prototype);
|
72
|
+
SVGPathSegMovetoRel.prototype.toString = function() { return "[object SVGPathSegMovetoRel]"; }
|
73
|
+
SVGPathSegMovetoRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
74
|
+
SVGPathSegMovetoRel.prototype.clone = function() { return new SVGPathSegMovetoRel(undefined, this._x, this._y); }
|
75
|
+
Object.defineProperty(SVGPathSegMovetoRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
76
|
+
Object.defineProperty(SVGPathSegMovetoRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
77
|
+
|
78
|
+
window.SVGPathSegLinetoAbs = function(owningPathSegList, x, y) {
|
79
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_ABS, "L", owningPathSegList);
|
80
|
+
this._x = x;
|
81
|
+
this._y = y;
|
82
|
+
}
|
83
|
+
SVGPathSegLinetoAbs.prototype = Object.create(SVGPathSeg.prototype);
|
84
|
+
SVGPathSegLinetoAbs.prototype.toString = function() { return "[object SVGPathSegLinetoAbs]"; }
|
85
|
+
SVGPathSegLinetoAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
86
|
+
SVGPathSegLinetoAbs.prototype.clone = function() { return new SVGPathSegLinetoAbs(undefined, this._x, this._y); }
|
87
|
+
Object.defineProperty(SVGPathSegLinetoAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
88
|
+
Object.defineProperty(SVGPathSegLinetoAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
89
|
+
|
90
|
+
window.SVGPathSegLinetoRel = function(owningPathSegList, x, y) {
|
91
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_REL, "l", owningPathSegList);
|
92
|
+
this._x = x;
|
93
|
+
this._y = y;
|
94
|
+
}
|
95
|
+
SVGPathSegLinetoRel.prototype = Object.create(SVGPathSeg.prototype);
|
96
|
+
SVGPathSegLinetoRel.prototype.toString = function() { return "[object SVGPathSegLinetoRel]"; }
|
97
|
+
SVGPathSegLinetoRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
98
|
+
SVGPathSegLinetoRel.prototype.clone = function() { return new SVGPathSegLinetoRel(undefined, this._x, this._y); }
|
99
|
+
Object.defineProperty(SVGPathSegLinetoRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
100
|
+
Object.defineProperty(SVGPathSegLinetoRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
101
|
+
|
102
|
+
window.SVGPathSegCurvetoCubicAbs = function(owningPathSegList, x, y, x1, y1, x2, y2) {
|
103
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, "C", owningPathSegList);
|
104
|
+
this._x = x;
|
105
|
+
this._y = y;
|
106
|
+
this._x1 = x1;
|
107
|
+
this._y1 = y1;
|
108
|
+
this._x2 = x2;
|
109
|
+
this._y2 = y2;
|
110
|
+
}
|
111
|
+
SVGPathSegCurvetoCubicAbs.prototype = Object.create(SVGPathSeg.prototype);
|
112
|
+
SVGPathSegCurvetoCubicAbs.prototype.toString = function() { return "[object SVGPathSegCurvetoCubicAbs]"; }
|
113
|
+
SVGPathSegCurvetoCubicAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y; }
|
114
|
+
SVGPathSegCurvetoCubicAbs.prototype.clone = function() { return new SVGPathSegCurvetoCubicAbs(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }
|
115
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
116
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
117
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "x1", { get: function() { return this._x1; }, set: function(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true });
|
118
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "y1", { get: function() { return this._y1; }, set: function(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true });
|
119
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "x2", { get: function() { return this._x2; }, set: function(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true });
|
120
|
+
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "y2", { get: function() { return this._y2; }, set: function(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true });
|
121
|
+
|
122
|
+
window.SVGPathSegCurvetoCubicRel = function(owningPathSegList, x, y, x1, y1, x2, y2) {
|
123
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, "c", owningPathSegList);
|
124
|
+
this._x = x;
|
125
|
+
this._y = y;
|
126
|
+
this._x1 = x1;
|
127
|
+
this._y1 = y1;
|
128
|
+
this._x2 = x2;
|
129
|
+
this._y2 = y2;
|
130
|
+
}
|
131
|
+
SVGPathSegCurvetoCubicRel.prototype = Object.create(SVGPathSeg.prototype);
|
132
|
+
SVGPathSegCurvetoCubicRel.prototype.toString = function() { return "[object SVGPathSegCurvetoCubicRel]"; }
|
133
|
+
SVGPathSegCurvetoCubicRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y; }
|
134
|
+
SVGPathSegCurvetoCubicRel.prototype.clone = function() { return new SVGPathSegCurvetoCubicRel(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }
|
135
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
136
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
137
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "x1", { get: function() { return this._x1; }, set: function(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true });
|
138
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "y1", { get: function() { return this._y1; }, set: function(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true });
|
139
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "x2", { get: function() { return this._x2; }, set: function(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true });
|
140
|
+
Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, "y2", { get: function() { return this._y2; }, set: function(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true });
|
141
|
+
|
142
|
+
window.SVGPathSegCurvetoQuadraticAbs = function(owningPathSegList, x, y, x1, y1) {
|
143
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, "Q", owningPathSegList);
|
144
|
+
this._x = x;
|
145
|
+
this._y = y;
|
146
|
+
this._x1 = x1;
|
147
|
+
this._y1 = y1;
|
148
|
+
}
|
149
|
+
SVGPathSegCurvetoQuadraticAbs.prototype = Object.create(SVGPathSeg.prototype);
|
150
|
+
SVGPathSegCurvetoQuadraticAbs.prototype.toString = function() { return "[object SVGPathSegCurvetoQuadraticAbs]"; }
|
151
|
+
SVGPathSegCurvetoQuadraticAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x + " " + this._y; }
|
152
|
+
SVGPathSegCurvetoQuadraticAbs.prototype.clone = function() { return new SVGPathSegCurvetoQuadraticAbs(undefined, this._x, this._y, this._x1, this._y1); }
|
153
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
154
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
155
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, "x1", { get: function() { return this._x1; }, set: function(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true });
|
156
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, "y1", { get: function() { return this._y1; }, set: function(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true });
|
157
|
+
|
158
|
+
window.SVGPathSegCurvetoQuadraticRel = function(owningPathSegList, x, y, x1, y1) {
|
159
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, "q", owningPathSegList);
|
160
|
+
this._x = x;
|
161
|
+
this._y = y;
|
162
|
+
this._x1 = x1;
|
163
|
+
this._y1 = y1;
|
164
|
+
}
|
165
|
+
SVGPathSegCurvetoQuadraticRel.prototype = Object.create(SVGPathSeg.prototype);
|
166
|
+
SVGPathSegCurvetoQuadraticRel.prototype.toString = function() { return "[object SVGPathSegCurvetoQuadraticRel]"; }
|
167
|
+
SVGPathSegCurvetoQuadraticRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x + " " + this._y; }
|
168
|
+
SVGPathSegCurvetoQuadraticRel.prototype.clone = function() { return new SVGPathSegCurvetoQuadraticRel(undefined, this._x, this._y, this._x1, this._y1); }
|
169
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
170
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
171
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, "x1", { get: function() { return this._x1; }, set: function(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true });
|
172
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, "y1", { get: function() { return this._y1; }, set: function(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true });
|
173
|
+
|
174
|
+
window.SVGPathSegArcAbs = function(owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
|
175
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_ARC_ABS, "A", owningPathSegList);
|
176
|
+
this._x = x;
|
177
|
+
this._y = y;
|
178
|
+
this._r1 = r1;
|
179
|
+
this._r2 = r2;
|
180
|
+
this._angle = angle;
|
181
|
+
this._largeArcFlag = largeArcFlag;
|
182
|
+
this._sweepFlag = sweepFlag;
|
183
|
+
}
|
184
|
+
SVGPathSegArcAbs.prototype = Object.create(SVGPathSeg.prototype);
|
185
|
+
SVGPathSegArcAbs.prototype.toString = function() { return "[object SVGPathSegArcAbs]"; }
|
186
|
+
SVGPathSegArcAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._r1 + " " + this._r2 + " " + this._angle + " " + (this._largeArcFlag ? "1" : "0") + " " + (this._sweepFlag ? "1" : "0") + " " + this._x + " " + this._y; }
|
187
|
+
SVGPathSegArcAbs.prototype.clone = function() { return new SVGPathSegArcAbs(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }
|
188
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
189
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
190
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "r1", { get: function() { return this._r1; }, set: function(r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true });
|
191
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "r2", { get: function() { return this._r2; }, set: function(r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true });
|
192
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "angle", { get: function() { return this._angle; }, set: function(angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true });
|
193
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "largeArcFlag", { get: function() { return this._largeArcFlag; }, set: function(largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true });
|
194
|
+
Object.defineProperty(SVGPathSegArcAbs.prototype, "sweepFlag", { get: function() { return this._sweepFlag; }, set: function(sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true });
|
195
|
+
|
196
|
+
window.SVGPathSegArcRel = function(owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
|
197
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_ARC_REL, "a", owningPathSegList);
|
198
|
+
this._x = x;
|
199
|
+
this._y = y;
|
200
|
+
this._r1 = r1;
|
201
|
+
this._r2 = r2;
|
202
|
+
this._angle = angle;
|
203
|
+
this._largeArcFlag = largeArcFlag;
|
204
|
+
this._sweepFlag = sweepFlag;
|
205
|
+
}
|
206
|
+
SVGPathSegArcRel.prototype = Object.create(SVGPathSeg.prototype);
|
207
|
+
SVGPathSegArcRel.prototype.toString = function() { return "[object SVGPathSegArcRel]"; }
|
208
|
+
SVGPathSegArcRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._r1 + " " + this._r2 + " " + this._angle + " " + (this._largeArcFlag ? "1" : "0") + " " + (this._sweepFlag ? "1" : "0") + " " + this._x + " " + this._y; }
|
209
|
+
SVGPathSegArcRel.prototype.clone = function() { return new SVGPathSegArcRel(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }
|
210
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
211
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
212
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "r1", { get: function() { return this._r1; }, set: function(r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true });
|
213
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "r2", { get: function() { return this._r2; }, set: function(r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true });
|
214
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "angle", { get: function() { return this._angle; }, set: function(angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true });
|
215
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "largeArcFlag", { get: function() { return this._largeArcFlag; }, set: function(largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true });
|
216
|
+
Object.defineProperty(SVGPathSegArcRel.prototype, "sweepFlag", { get: function() { return this._sweepFlag; }, set: function(sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true });
|
217
|
+
|
218
|
+
window.SVGPathSegLinetoHorizontalAbs = function(owningPathSegList, x) {
|
219
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, "H", owningPathSegList);
|
220
|
+
this._x = x;
|
221
|
+
}
|
222
|
+
SVGPathSegLinetoHorizontalAbs.prototype = Object.create(SVGPathSeg.prototype);
|
223
|
+
SVGPathSegLinetoHorizontalAbs.prototype.toString = function() { return "[object SVGPathSegLinetoHorizontalAbs]"; }
|
224
|
+
SVGPathSegLinetoHorizontalAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x; }
|
225
|
+
SVGPathSegLinetoHorizontalAbs.prototype.clone = function() { return new SVGPathSegLinetoHorizontalAbs(undefined, this._x); }
|
226
|
+
Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
227
|
+
|
228
|
+
window.SVGPathSegLinetoHorizontalRel = function(owningPathSegList, x) {
|
229
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, "h", owningPathSegList);
|
230
|
+
this._x = x;
|
231
|
+
}
|
232
|
+
SVGPathSegLinetoHorizontalRel.prototype = Object.create(SVGPathSeg.prototype);
|
233
|
+
SVGPathSegLinetoHorizontalRel.prototype.toString = function() { return "[object SVGPathSegLinetoHorizontalRel]"; }
|
234
|
+
SVGPathSegLinetoHorizontalRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x; }
|
235
|
+
SVGPathSegLinetoHorizontalRel.prototype.clone = function() { return new SVGPathSegLinetoHorizontalRel(undefined, this._x); }
|
236
|
+
Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
237
|
+
|
238
|
+
window.SVGPathSegLinetoVerticalAbs = function(owningPathSegList, y) {
|
239
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, "V", owningPathSegList);
|
240
|
+
this._y = y;
|
241
|
+
}
|
242
|
+
SVGPathSegLinetoVerticalAbs.prototype = Object.create(SVGPathSeg.prototype);
|
243
|
+
SVGPathSegLinetoVerticalAbs.prototype.toString = function() { return "[object SVGPathSegLinetoVerticalAbs]"; }
|
244
|
+
SVGPathSegLinetoVerticalAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._y; }
|
245
|
+
SVGPathSegLinetoVerticalAbs.prototype.clone = function() { return new SVGPathSegLinetoVerticalAbs(undefined, this._y); }
|
246
|
+
Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
247
|
+
|
248
|
+
window.SVGPathSegLinetoVerticalRel = function(owningPathSegList, y) {
|
249
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, "v", owningPathSegList);
|
250
|
+
this._y = y;
|
251
|
+
}
|
252
|
+
SVGPathSegLinetoVerticalRel.prototype = Object.create(SVGPathSeg.prototype);
|
253
|
+
SVGPathSegLinetoVerticalRel.prototype.toString = function() { return "[object SVGPathSegLinetoVerticalRel]"; }
|
254
|
+
SVGPathSegLinetoVerticalRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._y; }
|
255
|
+
SVGPathSegLinetoVerticalRel.prototype.clone = function() { return new SVGPathSegLinetoVerticalRel(undefined, this._y); }
|
256
|
+
Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
257
|
+
|
258
|
+
window.SVGPathSegCurvetoCubicSmoothAbs = function(owningPathSegList, x, y, x2, y2) {
|
259
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, "S", owningPathSegList);
|
260
|
+
this._x = x;
|
261
|
+
this._y = y;
|
262
|
+
this._x2 = x2;
|
263
|
+
this._y2 = y2;
|
264
|
+
}
|
265
|
+
SVGPathSegCurvetoCubicSmoothAbs.prototype = Object.create(SVGPathSeg.prototype);
|
266
|
+
SVGPathSegCurvetoCubicSmoothAbs.prototype.toString = function() { return "[object SVGPathSegCurvetoCubicSmoothAbs]"; }
|
267
|
+
SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y; }
|
268
|
+
SVGPathSegCurvetoCubicSmoothAbs.prototype.clone = function() { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, this._x, this._y, this._x2, this._y2); }
|
269
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
270
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
271
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, "x2", { get: function() { return this._x2; }, set: function(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true });
|
272
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, "y2", { get: function() { return this._y2; }, set: function(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true });
|
273
|
+
|
274
|
+
window.SVGPathSegCurvetoCubicSmoothRel = function(owningPathSegList, x, y, x2, y2) {
|
275
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, "s", owningPathSegList);
|
276
|
+
this._x = x;
|
277
|
+
this._y = y;
|
278
|
+
this._x2 = x2;
|
279
|
+
this._y2 = y2;
|
280
|
+
}
|
281
|
+
SVGPathSegCurvetoCubicSmoothRel.prototype = Object.create(SVGPathSeg.prototype);
|
282
|
+
SVGPathSegCurvetoCubicSmoothRel.prototype.toString = function() { return "[object SVGPathSegCurvetoCubicSmoothRel]"; }
|
283
|
+
SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y; }
|
284
|
+
SVGPathSegCurvetoCubicSmoothRel.prototype.clone = function() { return new SVGPathSegCurvetoCubicSmoothRel(undefined, this._x, this._y, this._x2, this._y2); }
|
285
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
286
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
287
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, "x2", { get: function() { return this._x2; }, set: function(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true });
|
288
|
+
Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, "y2", { get: function() { return this._y2; }, set: function(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true });
|
289
|
+
|
290
|
+
window.SVGPathSegCurvetoQuadraticSmoothAbs = function(owningPathSegList, x, y) {
|
291
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, "T", owningPathSegList);
|
292
|
+
this._x = x;
|
293
|
+
this._y = y;
|
294
|
+
}
|
295
|
+
SVGPathSegCurvetoQuadraticSmoothAbs.prototype = Object.create(SVGPathSeg.prototype);
|
296
|
+
SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString = function() { return "[object SVGPathSegCurvetoQuadraticSmoothAbs]"; }
|
297
|
+
SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
298
|
+
SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone = function() { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, this._x, this._y); }
|
299
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
300
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
301
|
+
|
302
|
+
window.SVGPathSegCurvetoQuadraticSmoothRel = function(owningPathSegList, x, y) {
|
303
|
+
SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "t", owningPathSegList);
|
304
|
+
this._x = x;
|
305
|
+
this._y = y;
|
306
|
+
}
|
307
|
+
SVGPathSegCurvetoQuadraticSmoothRel.prototype = Object.create(SVGPathSeg.prototype);
|
308
|
+
SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString = function() { return "[object SVGPathSegCurvetoQuadraticSmoothRel]"; }
|
309
|
+
SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString = function() { return this.pathSegTypeAsLetter + " " + this._x + " " + this._y; }
|
310
|
+
SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone = function() { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, this._x, this._y); }
|
311
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype, "x", { get: function() { return this._x; }, set: function(x) { this._x = x; this._segmentChanged(); }, enumerable: true });
|
312
|
+
Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype, "y", { get: function() { return this._y; }, set: function(y) { this._y = y; this._segmentChanged(); }, enumerable: true });
|
313
|
+
|
314
|
+
// Add createSVGPathSeg* functions to SVGPathElement.
|
315
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathElement.
|
316
|
+
SVGPathElement.prototype.createSVGPathSegClosePath = function() { return new SVGPathSegClosePath(undefined); }
|
317
|
+
SVGPathElement.prototype.createSVGPathSegMovetoAbs = function(x, y) { return new SVGPathSegMovetoAbs(undefined, x, y); }
|
318
|
+
SVGPathElement.prototype.createSVGPathSegMovetoRel = function(x, y) { return new SVGPathSegMovetoRel(undefined, x, y); }
|
319
|
+
SVGPathElement.prototype.createSVGPathSegLinetoAbs = function(x, y) { return new SVGPathSegLinetoAbs(undefined, x, y); }
|
320
|
+
SVGPathElement.prototype.createSVGPathSegLinetoRel = function(x, y) { return new SVGPathSegLinetoRel(undefined, x, y); }
|
321
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs = function(x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicAbs(undefined, x, y, x1, y1, x2, y2); }
|
322
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel = function(x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicRel(undefined, x, y, x1, y1, x2, y2); }
|
323
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs = function(x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticAbs(undefined, x, y, x1, y1); }
|
324
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel = function(x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticRel(undefined, x, y, x1, y1); }
|
325
|
+
SVGPathElement.prototype.createSVGPathSegArcAbs = function(x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcAbs(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); }
|
326
|
+
SVGPathElement.prototype.createSVGPathSegArcRel = function(x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcRel(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); }
|
327
|
+
SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs = function(x) { return new SVGPathSegLinetoHorizontalAbs(undefined, x); }
|
328
|
+
SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel = function(x) { return new SVGPathSegLinetoHorizontalRel(undefined, x); }
|
329
|
+
SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs = function(y) { return new SVGPathSegLinetoVerticalAbs(undefined, y); }
|
330
|
+
SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel = function(y) { return new SVGPathSegLinetoVerticalRel(undefined, y); }
|
331
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs = function(x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, x, y, x2, y2); }
|
332
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel = function(x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothRel(undefined, x, y, x2, y2); }
|
333
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs = function(x, y) { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, x, y); }
|
334
|
+
SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel = function(x, y) { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, x, y); }
|
335
|
+
}
|
336
|
+
|
337
|
+
if (!("SVGPathSegList" in window)) {
|
338
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSegList
|
339
|
+
window.SVGPathSegList = function(pathElement) {
|
340
|
+
this._pathElement = pathElement;
|
341
|
+
this._list = this._parsePath(this._pathElement.getAttribute("d"));
|
342
|
+
|
343
|
+
// Use a MutationObserver to catch changes to the path's "d" attribute.
|
344
|
+
this._mutationObserverConfig = { "attributes": true, "attributeFilter": ["d"] };
|
345
|
+
this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this));
|
346
|
+
this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
|
347
|
+
}
|
348
|
+
|
349
|
+
SVGPathSegList.prototype.classname = "SVGPathSegList";
|
350
|
+
|
351
|
+
Object.defineProperty(SVGPathSegList.prototype, "numberOfItems", {
|
352
|
+
get: function() {
|
353
|
+
this._checkPathSynchronizedToList();
|
354
|
+
return this._list.length;
|
355
|
+
},
|
356
|
+
enumerable: true
|
357
|
+
});
|
358
|
+
|
359
|
+
// Add the pathSegList accessors to SVGPathElement.
|
360
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData
|
361
|
+
Object.defineProperty(SVGPathElement.prototype, "pathSegList", {
|
362
|
+
get: function() {
|
363
|
+
if (!this._pathSegList)
|
364
|
+
this._pathSegList = new SVGPathSegList(this);
|
365
|
+
return this._pathSegList;
|
366
|
+
},
|
367
|
+
enumerable: true
|
368
|
+
});
|
369
|
+
// FIXME: The following are not implemented and simply return SVGPathElement.pathSegList.
|
370
|
+
Object.defineProperty(SVGPathElement.prototype, "normalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
|
371
|
+
Object.defineProperty(SVGPathElement.prototype, "animatedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
|
372
|
+
Object.defineProperty(SVGPathElement.prototype, "animatedNormalizedPathSegList", { get: function() { return this.pathSegList; }, enumerable: true });
|
373
|
+
|
374
|
+
// Process any pending mutations to the path element and update the list as needed.
|
375
|
+
// This should be the first call of all public functions and is needed because
|
376
|
+
// MutationObservers are not synchronous so we can have pending asynchronous mutations.
|
377
|
+
SVGPathSegList.prototype._checkPathSynchronizedToList = function() {
|
378
|
+
this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords());
|
379
|
+
}
|
380
|
+
|
381
|
+
SVGPathSegList.prototype._updateListFromPathMutations = function(mutationRecords) {
|
382
|
+
if (!this._pathElement)
|
383
|
+
return;
|
384
|
+
var hasPathMutations = false;
|
385
|
+
mutationRecords.forEach(function(record) {
|
386
|
+
if (record.attributeName == "d")
|
387
|
+
hasPathMutations = true;
|
388
|
+
});
|
389
|
+
if (hasPathMutations)
|
390
|
+
this._list = this._parsePath(this._pathElement.getAttribute("d"));
|
391
|
+
}
|
392
|
+
|
393
|
+
// Serialize the list and update the path's 'd' attribute.
|
394
|
+
SVGPathSegList.prototype._writeListToPath = function() {
|
395
|
+
this._pathElementMutationObserver.disconnect();
|
396
|
+
this._pathElement.setAttribute("d", SVGPathSegList._pathSegArrayAsString(this._list));
|
397
|
+
this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
|
398
|
+
}
|
399
|
+
|
400
|
+
// When a path segment changes the list needs to be synchronized back to the path element.
|
401
|
+
SVGPathSegList.prototype.segmentChanged = function(pathSeg) {
|
402
|
+
this._writeListToPath();
|
403
|
+
}
|
404
|
+
|
405
|
+
SVGPathSegList.prototype.clear = function() {
|
406
|
+
this._checkPathSynchronizedToList();
|
407
|
+
|
408
|
+
this._list.forEach(function(pathSeg) {
|
409
|
+
pathSeg._owningPathSegList = null;
|
410
|
+
});
|
411
|
+
this._list = [];
|
412
|
+
this._writeListToPath();
|
413
|
+
}
|
414
|
+
|
415
|
+
SVGPathSegList.prototype.initialize = function(newItem) {
|
416
|
+
this._checkPathSynchronizedToList();
|
417
|
+
|
418
|
+
this._list = [newItem];
|
419
|
+
newItem._owningPathSegList = this;
|
420
|
+
this._writeListToPath();
|
421
|
+
return newItem;
|
422
|
+
}
|
423
|
+
|
424
|
+
SVGPathSegList.prototype._checkValidIndex = function(index) {
|
425
|
+
if (isNaN(index) || index < 0 || index >= this.numberOfItems)
|
426
|
+
throw "INDEX_SIZE_ERR";
|
427
|
+
}
|
428
|
+
|
429
|
+
SVGPathSegList.prototype.getItem = function(index) {
|
430
|
+
this._checkPathSynchronizedToList();
|
431
|
+
|
432
|
+
this._checkValidIndex(index);
|
433
|
+
return this._list[index];
|
434
|
+
}
|
435
|
+
|
436
|
+
SVGPathSegList.prototype.insertItemBefore = function(newItem, index) {
|
437
|
+
this._checkPathSynchronizedToList();
|
438
|
+
|
439
|
+
// Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
|
440
|
+
if (index > this.numberOfItems)
|
441
|
+
index = this.numberOfItems;
|
442
|
+
if (newItem._owningPathSegList) {
|
443
|
+
// SVG2 spec says to make a copy.
|
444
|
+
newItem = newItem.clone();
|
445
|
+
}
|
446
|
+
this._list.splice(index, 0, newItem);
|
447
|
+
newItem._owningPathSegList = this;
|
448
|
+
this._writeListToPath();
|
449
|
+
return newItem;
|
450
|
+
}
|
451
|
+
|
452
|
+
SVGPathSegList.prototype.replaceItem = function(newItem, index) {
|
453
|
+
this._checkPathSynchronizedToList();
|
454
|
+
|
455
|
+
if (newItem._owningPathSegList) {
|
456
|
+
// SVG2 spec says to make a copy.
|
457
|
+
newItem = newItem.clone();
|
458
|
+
}
|
459
|
+
this._checkValidIndex(index);
|
460
|
+
this._list[index] = newItem;
|
461
|
+
newItem._owningPathSegList = this;
|
462
|
+
this._writeListToPath();
|
463
|
+
return newItem;
|
464
|
+
}
|
465
|
+
|
466
|
+
SVGPathSegList.prototype.removeItem = function(index) {
|
467
|
+
this._checkPathSynchronizedToList();
|
468
|
+
|
469
|
+
this._checkValidIndex(index);
|
470
|
+
var item = this._list[index];
|
471
|
+
this._list.splice(index, 1);
|
472
|
+
this._writeListToPath();
|
473
|
+
return item;
|
474
|
+
}
|
475
|
+
|
476
|
+
SVGPathSegList.prototype.appendItem = function(newItem) {
|
477
|
+
this._checkPathSynchronizedToList();
|
478
|
+
|
479
|
+
if (newItem._owningPathSegList) {
|
480
|
+
// SVG2 spec says to make a copy.
|
481
|
+
newItem = newItem.clone();
|
482
|
+
}
|
483
|
+
this._list.push(newItem);
|
484
|
+
newItem._owningPathSegList = this;
|
485
|
+
// TODO: Optimize this to just append to the existing attribute.
|
486
|
+
this._writeListToPath();
|
487
|
+
return newItem;
|
488
|
+
}
|
489
|
+
|
490
|
+
SVGPathSegList._pathSegArrayAsString = function(pathSegArray) {
|
491
|
+
var string = "";
|
492
|
+
var first = true;
|
493
|
+
pathSegArray.forEach(function(pathSeg) {
|
494
|
+
if (first) {
|
495
|
+
first = false;
|
496
|
+
string += pathSeg._asPathString();
|
497
|
+
} else {
|
498
|
+
string += " " + pathSeg._asPathString();
|
499
|
+
}
|
500
|
+
});
|
501
|
+
return string;
|
502
|
+
}
|
503
|
+
|
504
|
+
// This closely follows SVGPathParser::parsePath from Source/core/svg/SVGPathParser.cpp.
|
505
|
+
SVGPathSegList.prototype._parsePath = function(string) {
|
506
|
+
if (!string || string.length == 0)
|
507
|
+
return [];
|
508
|
+
|
509
|
+
var owningPathSegList = this;
|
510
|
+
|
511
|
+
var Builder = function() {
|
512
|
+
this.pathSegList = [];
|
513
|
+
}
|
514
|
+
|
515
|
+
Builder.prototype.appendSegment = function(pathSeg) {
|
516
|
+
this.pathSegList.push(pathSeg);
|
517
|
+
}
|
518
|
+
|
519
|
+
var Source = function(string) {
|
520
|
+
this._string = string;
|
521
|
+
this._currentIndex = 0;
|
522
|
+
this._endIndex = this._string.length;
|
523
|
+
this._previousCommand = SVGPathSeg.PATHSEG_UNKNOWN;
|
524
|
+
|
525
|
+
this._skipOptionalSpaces();
|
526
|
+
}
|
527
|
+
|
528
|
+
Source.prototype._isCurrentSpace = function() {
|
529
|
+
var character = this._string[this._currentIndex];
|
530
|
+
return character <= " " && (character == " " || character == "\n" || character == "\t" || character == "\r" || character == "\f");
|
531
|
+
}
|
532
|
+
|
533
|
+
Source.prototype._skipOptionalSpaces = function() {
|
534
|
+
while (this._currentIndex < this._endIndex && this._isCurrentSpace())
|
535
|
+
this._currentIndex++;
|
536
|
+
return this._currentIndex < this._endIndex;
|
537
|
+
}
|
538
|
+
|
539
|
+
Source.prototype._skipOptionalSpacesOrDelimiter = function() {
|
540
|
+
if (this._currentIndex < this._endIndex && !this._isCurrentSpace() && this._string.charAt(this._currentIndex) != ",")
|
541
|
+
return false;
|
542
|
+
if (this._skipOptionalSpaces()) {
|
543
|
+
if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ",") {
|
544
|
+
this._currentIndex++;
|
545
|
+
this._skipOptionalSpaces();
|
546
|
+
}
|
547
|
+
}
|
548
|
+
return this._currentIndex < this._endIndex;
|
549
|
+
}
|
550
|
+
|
551
|
+
Source.prototype.hasMoreData = function() {
|
552
|
+
return this._currentIndex < this._endIndex;
|
553
|
+
}
|
554
|
+
|
555
|
+
Source.prototype.peekSegmentType = function() {
|
556
|
+
var lookahead = this._string[this._currentIndex];
|
557
|
+
return this._pathSegTypeFromChar(lookahead);
|
558
|
+
}
|
559
|
+
|
560
|
+
Source.prototype._pathSegTypeFromChar = function(lookahead) {
|
561
|
+
switch (lookahead) {
|
562
|
+
case "Z":
|
563
|
+
case "z":
|
564
|
+
return SVGPathSeg.PATHSEG_CLOSEPATH;
|
565
|
+
case "M":
|
566
|
+
return SVGPathSeg.PATHSEG_MOVETO_ABS;
|
567
|
+
case "m":
|
568
|
+
return SVGPathSeg.PATHSEG_MOVETO_REL;
|
569
|
+
case "L":
|
570
|
+
return SVGPathSeg.PATHSEG_LINETO_ABS;
|
571
|
+
case "l":
|
572
|
+
return SVGPathSeg.PATHSEG_LINETO_REL;
|
573
|
+
case "C":
|
574
|
+
return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;
|
575
|
+
case "c":
|
576
|
+
return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;
|
577
|
+
case "Q":
|
578
|
+
return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;
|
579
|
+
case "q":
|
580
|
+
return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;
|
581
|
+
case "A":
|
582
|
+
return SVGPathSeg.PATHSEG_ARC_ABS;
|
583
|
+
case "a":
|
584
|
+
return SVGPathSeg.PATHSEG_ARC_REL;
|
585
|
+
case "H":
|
586
|
+
return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;
|
587
|
+
case "h":
|
588
|
+
return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;
|
589
|
+
case "V":
|
590
|
+
return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;
|
591
|
+
case "v":
|
592
|
+
return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;
|
593
|
+
case "S":
|
594
|
+
return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
|
595
|
+
case "s":
|
596
|
+
return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
|
597
|
+
case "T":
|
598
|
+
return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
|
599
|
+
case "t":
|
600
|
+
return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
|
601
|
+
default:
|
602
|
+
return SVGPathSeg.PATHSEG_UNKNOWN;
|
603
|
+
}
|
604
|
+
}
|
605
|
+
|
606
|
+
Source.prototype._nextCommandHelper = function(lookahead, previousCommand) {
|
607
|
+
// Check for remaining coordinates in the current command.
|
608
|
+
if ((lookahead == "+" || lookahead == "-" || lookahead == "." || (lookahead >= "0" && lookahead <= "9")) && previousCommand != SVGPathSeg.PATHSEG_CLOSEPATH) {
|
609
|
+
if (previousCommand == SVGPathSeg.PATHSEG_MOVETO_ABS)
|
610
|
+
return SVGPathSeg.PATHSEG_LINETO_ABS;
|
611
|
+
if (previousCommand == SVGPathSeg.PATHSEG_MOVETO_REL)
|
612
|
+
return SVGPathSeg.PATHSEG_LINETO_REL;
|
613
|
+
return previousCommand;
|
614
|
+
}
|
615
|
+
return SVGPathSeg.PATHSEG_UNKNOWN;
|
616
|
+
}
|
617
|
+
|
618
|
+
Source.prototype.initialCommandIsMoveTo = function() {
|
619
|
+
// If the path is empty it is still valid, so return true.
|
620
|
+
if (!this.hasMoreData())
|
621
|
+
return true;
|
622
|
+
var command = this.peekSegmentType();
|
623
|
+
// Path must start with moveTo.
|
624
|
+
return command == SVGPathSeg.PATHSEG_MOVETO_ABS || command == SVGPathSeg.PATHSEG_MOVETO_REL;
|
625
|
+
}
|
626
|
+
|
627
|
+
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp.
|
628
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF
|
629
|
+
Source.prototype._parseNumber = function() {
|
630
|
+
var exponent = 0;
|
631
|
+
var integer = 0;
|
632
|
+
var frac = 1;
|
633
|
+
var decimal = 0;
|
634
|
+
var sign = 1;
|
635
|
+
var expsign = 1;
|
636
|
+
|
637
|
+
var startIndex = this._currentIndex;
|
638
|
+
|
639
|
+
this._skipOptionalSpaces();
|
640
|
+
|
641
|
+
// Read the sign.
|
642
|
+
if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "+")
|
643
|
+
this._currentIndex++;
|
644
|
+
else if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "-") {
|
645
|
+
this._currentIndex++;
|
646
|
+
sign = -1;
|
647
|
+
}
|
648
|
+
|
649
|
+
if (this._currentIndex == this._endIndex || ((this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9") && this._string.charAt(this._currentIndex) != "."))
|
650
|
+
// The first character of a number must be one of [0-9+-.].
|
651
|
+
return undefined;
|
652
|
+
|
653
|
+
// Read the integer part, build right-to-left.
|
654
|
+
var startIntPartIndex = this._currentIndex;
|
655
|
+
while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= "0" && this._string.charAt(this._currentIndex) <= "9")
|
656
|
+
this._currentIndex++; // Advance to first non-digit.
|
657
|
+
|
658
|
+
if (this._currentIndex != startIntPartIndex) {
|
659
|
+
var scanIntPartIndex = this._currentIndex - 1;
|
660
|
+
var multiplier = 1;
|
661
|
+
while (scanIntPartIndex >= startIntPartIndex) {
|
662
|
+
integer += multiplier * (this._string.charAt(scanIntPartIndex--) - "0");
|
663
|
+
multiplier *= 10;
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
// Read the decimals.
|
668
|
+
if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ".") {
|
669
|
+
this._currentIndex++;
|
670
|
+
|
671
|
+
// There must be a least one digit following the .
|
672
|
+
if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9")
|
673
|
+
return undefined;
|
674
|
+
while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= "0" && this._string.charAt(this._currentIndex) <= "9")
|
675
|
+
decimal += (this._string.charAt(this._currentIndex++) - "0") * (frac *= 0.1);
|
676
|
+
}
|
677
|
+
|
678
|
+
// Read the exponent part.
|
679
|
+
if (this._currentIndex != startIndex && this._currentIndex + 1 < this._endIndex && (this._string.charAt(this._currentIndex) == "e" || this._string.charAt(this._currentIndex) == "E") && (this._string.charAt(this._currentIndex + 1) != "x" && this._string.charAt(this._currentIndex + 1) != "m")) {
|
680
|
+
this._currentIndex++;
|
681
|
+
|
682
|
+
// Read the sign of the exponent.
|
683
|
+
if (this._string.charAt(this._currentIndex) == "+") {
|
684
|
+
this._currentIndex++;
|
685
|
+
} else if (this._string.charAt(this._currentIndex) == "-") {
|
686
|
+
this._currentIndex++;
|
687
|
+
expsign = -1;
|
688
|
+
}
|
689
|
+
|
690
|
+
// There must be an exponent.
|
691
|
+
if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9")
|
692
|
+
return undefined;
|
693
|
+
|
694
|
+
while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= "0" && this._string.charAt(this._currentIndex) <= "9") {
|
695
|
+
exponent *= 10;
|
696
|
+
exponent += (this._string.charAt(this._currentIndex) - "0");
|
697
|
+
this._currentIndex++;
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
var number = integer + decimal;
|
702
|
+
number *= sign;
|
703
|
+
|
704
|
+
if (exponent)
|
705
|
+
number *= Math.pow(10, expsign * exponent);
|
706
|
+
|
707
|
+
if (startIndex == this._currentIndex)
|
708
|
+
return undefined;
|
709
|
+
|
710
|
+
this._skipOptionalSpacesOrDelimiter();
|
711
|
+
|
712
|
+
return number;
|
713
|
+
}
|
714
|
+
|
715
|
+
Source.prototype._parseArcFlag = function() {
|
716
|
+
if (this._currentIndex >= this._endIndex)
|
717
|
+
return undefined;
|
718
|
+
var flag = false;
|
719
|
+
var flagChar = this._string.charAt(this._currentIndex++);
|
720
|
+
if (flagChar == "0")
|
721
|
+
flag = false;
|
722
|
+
else if (flagChar == "1")
|
723
|
+
flag = true;
|
724
|
+
else
|
725
|
+
return undefined;
|
726
|
+
|
727
|
+
this._skipOptionalSpacesOrDelimiter();
|
728
|
+
return flag;
|
729
|
+
}
|
730
|
+
|
731
|
+
Source.prototype.parseSegment = function() {
|
732
|
+
var lookahead = this._string[this._currentIndex];
|
733
|
+
var command = this._pathSegTypeFromChar(lookahead);
|
734
|
+
if (command == SVGPathSeg.PATHSEG_UNKNOWN) {
|
735
|
+
// Possibly an implicit command. Not allowed if this is the first command.
|
736
|
+
if (this._previousCommand == SVGPathSeg.PATHSEG_UNKNOWN)
|
737
|
+
return null;
|
738
|
+
command = this._nextCommandHelper(lookahead, this._previousCommand);
|
739
|
+
if (command == SVGPathSeg.PATHSEG_UNKNOWN)
|
740
|
+
return null;
|
741
|
+
} else {
|
742
|
+
this._currentIndex++;
|
743
|
+
}
|
744
|
+
|
745
|
+
this._previousCommand = command;
|
746
|
+
|
747
|
+
switch (command) {
|
748
|
+
case SVGPathSeg.PATHSEG_MOVETO_REL:
|
749
|
+
return new SVGPathSegMovetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());
|
750
|
+
case SVGPathSeg.PATHSEG_MOVETO_ABS:
|
751
|
+
return new SVGPathSegMovetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
|
752
|
+
case SVGPathSeg.PATHSEG_LINETO_REL:
|
753
|
+
return new SVGPathSegLinetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());
|
754
|
+
case SVGPathSeg.PATHSEG_LINETO_ABS:
|
755
|
+
return new SVGPathSegLinetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
|
756
|
+
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
|
757
|
+
return new SVGPathSegLinetoHorizontalRel(owningPathSegList, this._parseNumber());
|
758
|
+
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
|
759
|
+
return new SVGPathSegLinetoHorizontalAbs(owningPathSegList, this._parseNumber());
|
760
|
+
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
|
761
|
+
return new SVGPathSegLinetoVerticalRel(owningPathSegList, this._parseNumber());
|
762
|
+
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
|
763
|
+
return new SVGPathSegLinetoVerticalAbs(owningPathSegList, this._parseNumber());
|
764
|
+
case SVGPathSeg.PATHSEG_CLOSEPATH:
|
765
|
+
this._skipOptionalSpaces();
|
766
|
+
return new SVGPathSegClosePath(owningPathSegList);
|
767
|
+
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
|
768
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
769
|
+
return new SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
|
770
|
+
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
|
771
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
772
|
+
return new SVGPathSegCurvetoCubicAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
|
773
|
+
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
|
774
|
+
var points = {x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
775
|
+
return new SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, points.x, points.y, points.x2, points.y2);
|
776
|
+
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
|
777
|
+
var points = {x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
778
|
+
return new SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, points.x, points.y, points.x2, points.y2);
|
779
|
+
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
|
780
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
781
|
+
return new SVGPathSegCurvetoQuadraticRel(owningPathSegList, points.x, points.y, points.x1, points.y1);
|
782
|
+
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
|
783
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};
|
784
|
+
return new SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1);
|
785
|
+
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
|
786
|
+
return new SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber());
|
787
|
+
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
|
788
|
+
return new SVGPathSegCurvetoQuadraticSmoothAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
|
789
|
+
case SVGPathSeg.PATHSEG_ARC_REL:
|
790
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber()};
|
791
|
+
return new SVGPathSegArcRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
|
792
|
+
case SVGPathSeg.PATHSEG_ARC_ABS:
|
793
|
+
var points = {x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber()};
|
794
|
+
return new SVGPathSegArcAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
|
795
|
+
default:
|
796
|
+
throw "Unknown path seg type."
|
797
|
+
}
|
798
|
+
}
|
799
|
+
|
800
|
+
var builder = new Builder();
|
801
|
+
var source = new Source(string);
|
802
|
+
|
803
|
+
if (!source.initialCommandIsMoveTo())
|
804
|
+
return [];
|
805
|
+
while (source.hasMoreData()) {
|
806
|
+
var pathSeg = source.parseSegment();
|
807
|
+
if (!pathSeg)
|
808
|
+
return [];
|
809
|
+
builder.appendSegment(pathSeg);
|
810
|
+
}
|
811
|
+
|
812
|
+
return builder.pathSegList;
|
813
|
+
}
|
814
|
+
}
|
815
|
+
}());
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pathseg-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- javimbk
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: The gem provides pathseg.js by progers on your Rails project.
|
42
|
+
email:
|
43
|
+
- javimbk@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- lib/pathseg-rails.rb
|
58
|
+
- lib/pathseg-rails/version.rb
|
59
|
+
- pathseg-rails.gemspec
|
60
|
+
- vendor/assets/javascripts/pathseg.js
|
61
|
+
homepage: https://github.com/javimbk/pathseg-rails
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.5.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: A polyfill for SVG's SVGPathSeg and SVGPathSegList in Rails.
|
85
|
+
test_files: []
|
86
|
+
has_rdoc:
|