jvectormap-rails4 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/History.txt +3 -0
- data/README.md +60 -0
- data/Rakefile +38 -0
- data/jvectormap-rails4.gemspec +20 -0
- data/lib/jvectormap/rails4/engine.rb +8 -0
- data/lib/jvectormap/rails4/railtie.rb +17 -0
- data/lib/jvectormap/rails4/version.rb +8 -0
- data/lib/jvectormap/rails4.rb +7 -0
- data/lib/jvectormap-rails4.rb +26 -0
- data/tasks/jvectormap.rake +6 -0
- data/vendor/assets/javascripts/jvectormap/jquery-jvectormap.js +45 -0
- data/vendor/assets/javascripts/jvectormap/jquery-mousewheel.js +84 -0
- data/vendor/assets/javascripts/jvectormap/lib/abstract-canvas-element.js +67 -0
- data/vendor/assets/javascripts/jvectormap/lib/abstract-element.js +73 -0
- data/vendor/assets/javascripts/jvectormap/lib/abstract-shape-element.js +85 -0
- data/vendor/assets/javascripts/jvectormap/lib/color-scale.js +44 -0
- data/vendor/assets/javascripts/jvectormap/lib/data-series.js +139 -0
- data/vendor/assets/javascripts/jvectormap/lib/jvectormap.js +99 -0
- data/vendor/assets/javascripts/jvectormap/lib/numeric-scale.js +147 -0
- data/vendor/assets/javascripts/jvectormap/lib/ordinal-scale.js +7 -0
- data/vendor/assets/javascripts/jvectormap/lib/proj.js +181 -0
- data/vendor/assets/javascripts/jvectormap/lib/simple-scale.js +7 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-canvas-element.js +22 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-circle-element.js +5 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-element.js +48 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-group-element.js +9 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-path-element.js +6 -0
- data/vendor/assets/javascripts/jvectormap/lib/svg-shape-element.js +7 -0
- data/vendor/assets/javascripts/jvectormap/lib/vector-canvas.js +16 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-canvas-element.js +45 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-circle-element.js +26 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-element.js +106 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-group-element.js +13 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-path-element.js +111 -0
- data/vendor/assets/javascripts/jvectormap/lib/vml-shape-element.js +49 -0
- data/vendor/assets/javascripts/jvectormap/lib/world-map.js +977 -0
- data/vendor/assets/javascripts/jvectormap/maps/ar_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ar_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/at_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/at_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/au_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/au_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/be_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/be_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_lcc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ch_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ch_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/cn_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/cn_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/co_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/co_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/de_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/de_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/dk_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/dk_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/es_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/es_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/europe_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/europe_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/in_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/in_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nl_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nl_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/no_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/no_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nz_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nz_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ph_regions_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ph_regions_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pl_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pl_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pt_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pt_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/se_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/se_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_regions_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_regions_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-il-chicago_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-ny-newyork_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_aea_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_lcc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ve_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ve_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/world_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/world_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/za_merc_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/za_mill_en.js +1 -0
- data/vendor/assets/javascripts/jvectormap.js +26 -0
- data/vendor/assets/stylesheets/jvectormap.css +37 -0
- metadata +159 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* Class for vector images manipulations.
|
3
|
+
* @constructor
|
4
|
+
* @param {DOMElement} container to place canvas to
|
5
|
+
* @param {Number} width
|
6
|
+
* @param {Number} height
|
7
|
+
*/
|
8
|
+
jvm.VectorCanvas = function(container, width, height) {
|
9
|
+
this.mode = window.SVGAngle ? 'svg' : 'vml';
|
10
|
+
if (this.mode == 'svg') {
|
11
|
+
this.impl = new jvm.SVGCanvasElement(container, width, height);
|
12
|
+
} else {
|
13
|
+
this.impl = new jvm.VMLCanvasElement(container, width, height);
|
14
|
+
}
|
15
|
+
return this.impl;
|
16
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
jvm.VMLCanvasElement = function(container, width, height){
|
2
|
+
this.classPrefix = 'VML';
|
3
|
+
jvm.VMLCanvasElement.parentClass.call(this, 'group');
|
4
|
+
jvm.AbstractCanvasElement.apply(this, arguments);
|
5
|
+
this.node.style.position = 'absolute';
|
6
|
+
};
|
7
|
+
|
8
|
+
jvm.inherits(jvm.VMLCanvasElement, jvm.VMLElement);
|
9
|
+
jvm.mixin(jvm.VMLCanvasElement, jvm.AbstractCanvasElement);
|
10
|
+
|
11
|
+
jvm.VMLCanvasElement.prototype.setSize = function(width, height){
|
12
|
+
var paths,
|
13
|
+
groups,
|
14
|
+
i,
|
15
|
+
l;
|
16
|
+
|
17
|
+
this.width = width;
|
18
|
+
this.height = height;
|
19
|
+
this.node.style.width = width + "px";
|
20
|
+
this.node.style.height = height + "px";
|
21
|
+
this.node.coordsize = width+' '+height;
|
22
|
+
this.node.coordorigin = "0 0";
|
23
|
+
if (this.rootElement) {
|
24
|
+
paths = this.rootElement.node.getElementsByTagName('shape');
|
25
|
+
for(i = 0, l = paths.length; i < l; i++) {
|
26
|
+
paths[i].coordsize = width+' '+height;
|
27
|
+
paths[i].style.width = width+'px';
|
28
|
+
paths[i].style.height = height+'px';
|
29
|
+
}
|
30
|
+
groups = this.node.getElementsByTagName('group');
|
31
|
+
for(i = 0, l = groups.length; i < l; i++) {
|
32
|
+
groups[i].coordsize = width+' '+height;
|
33
|
+
groups[i].style.width = width+'px';
|
34
|
+
groups[i].style.height = height+'px';
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
jvm.VMLCanvasElement.prototype.applyTransformParams = function(scale, transX, transY) {
|
40
|
+
this.scale = scale;
|
41
|
+
this.transX = transX;
|
42
|
+
this.transY = transY;
|
43
|
+
this.rootElement.node.coordorigin = (this.width-transX-this.width/100)+','+(this.height-transY-this.height/100);
|
44
|
+
this.rootElement.node.coordsize = this.width/scale+','+this.height/scale;
|
45
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
jvm.VMLCircleElement = function(config, style){
|
2
|
+
jvm.VMLCircleElement.parentClass.call(this, 'oval', config, style);
|
3
|
+
};
|
4
|
+
|
5
|
+
jvm.inherits(jvm.VMLCircleElement, jvm.VMLShapeElement);
|
6
|
+
|
7
|
+
jvm.VMLCircleElement.prototype.applyAttr = function(attr, value){
|
8
|
+
switch (attr) {
|
9
|
+
case 'r':
|
10
|
+
this.node.style.width = value*2+'px';
|
11
|
+
this.node.style.height = value*2+'px';
|
12
|
+
this.applyAttr('cx', this.get('cx') || 0);
|
13
|
+
this.applyAttr('cy', this.get('cy') || 0);
|
14
|
+
break;
|
15
|
+
case 'cx':
|
16
|
+
if (!value) return;
|
17
|
+
this.node.style.left = value - (this.get('r') || 0) + 'px';
|
18
|
+
break;
|
19
|
+
case 'cy':
|
20
|
+
if (!value) return;
|
21
|
+
this.node.style.top = value - (this.get('r') || 0) + 'px';
|
22
|
+
break;
|
23
|
+
default:
|
24
|
+
jvm.VMLCircleElement.parentClass.prototype.applyAttr.call(this, attr, value);
|
25
|
+
}
|
26
|
+
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/**
|
2
|
+
* Wrapper for VML element.
|
3
|
+
* @constructor
|
4
|
+
* @extends jvm.AbstractElement
|
5
|
+
* @param {String} name Tag name of the element
|
6
|
+
* @param {Object} config Set of parameters to initialize element with
|
7
|
+
*/
|
8
|
+
|
9
|
+
jvm.VMLElement = function(name, config){
|
10
|
+
if (!jvm.VMLElement.VMLInitialized) {
|
11
|
+
jvm.VMLElement.initializeVML();
|
12
|
+
}
|
13
|
+
|
14
|
+
jvm.VMLElement.parentClass.apply(this, arguments);
|
15
|
+
};
|
16
|
+
|
17
|
+
jvm.inherits(jvm.VMLElement, jvm.AbstractElement);
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Shows if VML was already initialized for the current document or not.
|
21
|
+
* @static
|
22
|
+
* @private
|
23
|
+
* @type {Boolean}
|
24
|
+
*/
|
25
|
+
jvm.VMLElement.VMLInitialized = false;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Initializes VML handling before creating the first element
|
29
|
+
* (adds CSS class and creates namespace). Adds one of two forms
|
30
|
+
* of createElement method depending of support by browser.
|
31
|
+
* @static
|
32
|
+
* @private
|
33
|
+
*/
|
34
|
+
|
35
|
+
// The following method of VML handling is borrowed from the
|
36
|
+
// Raphael library by Dmitry Baranovsky.
|
37
|
+
|
38
|
+
jvm.VMLElement.initializeVML = function(){
|
39
|
+
try {
|
40
|
+
if (!document.namespaces.rvml) {
|
41
|
+
document.namespaces.add("rvml","urn:schemas-microsoft-com:vml");
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Creates DOM element.
|
45
|
+
* @param {String} tagName Name of element
|
46
|
+
* @private
|
47
|
+
* @returns DOMElement
|
48
|
+
*/
|
49
|
+
jvm.VMLElement.prototype.createElement = function (tagName) {
|
50
|
+
return document.createElement('<rvml:' + tagName + ' class="rvml">');
|
51
|
+
};
|
52
|
+
} catch (e) {
|
53
|
+
/**
|
54
|
+
* @private
|
55
|
+
*/
|
56
|
+
jvm.VMLElement.prototype.createElement = function (tagName) {
|
57
|
+
return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
|
58
|
+
};
|
59
|
+
}
|
60
|
+
document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
|
61
|
+
jvm.VMLElement.VMLInitialized = true;
|
62
|
+
};
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Returns constructor for element by name prefixed with 'VML'.
|
66
|
+
* @param {String} ctr Name of basic constructor to return
|
67
|
+
* proper implementation for.
|
68
|
+
* @returns Function
|
69
|
+
* @private
|
70
|
+
*/
|
71
|
+
jvm.VMLElement.prototype.getElementCtr = function( ctr ){
|
72
|
+
return jvm['VML'+ctr];
|
73
|
+
};
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Adds CSS class for underlying DOM element.
|
77
|
+
* @param {String} className Name of CSS class name
|
78
|
+
*/
|
79
|
+
jvm.VMLElement.prototype.addClass = function( className ){
|
80
|
+
jvm.$(this.node).addClass(className);
|
81
|
+
};
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Applies attribute value to the underlying DOM element.
|
85
|
+
* @param {String} name Name of attribute
|
86
|
+
* @param {Number|String} config Value of attribute to apply
|
87
|
+
* @private
|
88
|
+
*/
|
89
|
+
jvm.VMLElement.prototype.applyAttr = function( attr, value ){
|
90
|
+
this.node[attr] = value;
|
91
|
+
};
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Returns boundary box for the element.
|
95
|
+
* @returns {Object} Boundary box with numeric fields: x, y, width, height
|
96
|
+
* @override
|
97
|
+
*/
|
98
|
+
jvm.VMLElement.prototype.getBBox = function(){
|
99
|
+
var node = jvm.$(this.node);
|
100
|
+
return {
|
101
|
+
x: node.position().left / this.canvas.scale,
|
102
|
+
y: node.position().top / this.canvas.scale,
|
103
|
+
width: node.width() / this.canvas.scale,
|
104
|
+
height: node.height() / this.canvas.scale
|
105
|
+
};
|
106
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
jvm.VMLGroupElement = function(){
|
2
|
+
jvm.VMLGroupElement.parentClass.call(this, 'group');
|
3
|
+
|
4
|
+
this.node.style.left = '0px';
|
5
|
+
this.node.style.top = '0px';
|
6
|
+
this.node.coordorigin = "0 0";
|
7
|
+
};
|
8
|
+
|
9
|
+
jvm.inherits(jvm.VMLGroupElement, jvm.VMLElement);
|
10
|
+
|
11
|
+
jvm.VMLGroupElement.prototype.add = function(element){
|
12
|
+
this.node.appendChild( element.node );
|
13
|
+
};
|
@@ -0,0 +1,111 @@
|
|
1
|
+
jvm.VMLPathElement = function(config, style){
|
2
|
+
var scale = new jvm.VMLElement('skew');
|
3
|
+
|
4
|
+
jvm.VMLPathElement.parentClass.call(this, 'shape', config, style);
|
5
|
+
|
6
|
+
this.node.coordorigin = "0 0";
|
7
|
+
|
8
|
+
scale.node.on = true;
|
9
|
+
scale.node.matrix = '0.01,0,0,0.01,0,0';
|
10
|
+
scale.node.offset = '0,0';
|
11
|
+
|
12
|
+
this.node.appendChild(scale.node);
|
13
|
+
};
|
14
|
+
|
15
|
+
jvm.inherits(jvm.VMLPathElement, jvm.VMLShapeElement);
|
16
|
+
|
17
|
+
jvm.VMLPathElement.prototype.applyAttr = function(attr, value){
|
18
|
+
if (attr === 'd') {
|
19
|
+
this.node.path = jvm.VMLPathElement.pathSvgToVml(value);
|
20
|
+
} else {
|
21
|
+
jvm.VMLShapeElement.prototype.applyAttr.call(this, attr, value);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
|
25
|
+
jvm.VMLPathElement.pathSvgToVml = function(path) {
|
26
|
+
var result = '',
|
27
|
+
cx = 0, cy = 0, ctrlx, ctrly;
|
28
|
+
|
29
|
+
path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
|
30
|
+
return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
|
31
|
+
coords = coords.replace(/(\d)-/g, '$1,-')
|
32
|
+
.replace(/^\s+/g, '')
|
33
|
+
.replace(/\s+$/g, '')
|
34
|
+
.replace(/\s+/g, ',').split(',');
|
35
|
+
if (!coords[0]) coords.shift();
|
36
|
+
for (var i=0, l=coords.length; i<l; i++) {
|
37
|
+
coords[i] = Math.round(100*coords[i]);
|
38
|
+
}
|
39
|
+
switch (letter) {
|
40
|
+
case 'm':
|
41
|
+
cx += coords[0];
|
42
|
+
cy += coords[1];
|
43
|
+
return 't'+coords.join(',');
|
44
|
+
break;
|
45
|
+
case 'M':
|
46
|
+
cx = coords[0];
|
47
|
+
cy = coords[1];
|
48
|
+
return 'm'+coords.join(',');
|
49
|
+
break;
|
50
|
+
case 'l':
|
51
|
+
cx += coords[0];
|
52
|
+
cy += coords[1];
|
53
|
+
return 'r'+coords.join(',');
|
54
|
+
break;
|
55
|
+
case 'L':
|
56
|
+
cx = coords[0];
|
57
|
+
cy = coords[1];
|
58
|
+
return 'l'+coords.join(',');
|
59
|
+
break;
|
60
|
+
case 'h':
|
61
|
+
cx += coords[0];
|
62
|
+
return 'r'+coords[0]+',0';
|
63
|
+
break;
|
64
|
+
case 'H':
|
65
|
+
cx = coords[0];
|
66
|
+
return 'l'+cx+','+cy;
|
67
|
+
break;
|
68
|
+
case 'v':
|
69
|
+
cy += coords[0];
|
70
|
+
return 'r0,'+coords[0];
|
71
|
+
break;
|
72
|
+
case 'V':
|
73
|
+
cy = coords[0];
|
74
|
+
return 'l'+cx+','+cy;
|
75
|
+
break;
|
76
|
+
case 'c':
|
77
|
+
ctrlx = cx + coords[coords.length-4];
|
78
|
+
ctrly = cy + coords[coords.length-3];
|
79
|
+
cx += coords[coords.length-2];
|
80
|
+
cy += coords[coords.length-1];
|
81
|
+
return 'v'+coords.join(',');
|
82
|
+
break;
|
83
|
+
case 'C':
|
84
|
+
ctrlx = coords[coords.length-4];
|
85
|
+
ctrly = coords[coords.length-3];
|
86
|
+
cx = coords[coords.length-2];
|
87
|
+
cy = coords[coords.length-1];
|
88
|
+
return 'c'+coords.join(',');
|
89
|
+
break;
|
90
|
+
case 's':
|
91
|
+
coords.unshift(cy-ctrly);
|
92
|
+
coords.unshift(cx-ctrlx);
|
93
|
+
ctrlx = cx + coords[coords.length-4];
|
94
|
+
ctrly = cy + coords[coords.length-3];
|
95
|
+
cx += coords[coords.length-2];
|
96
|
+
cy += coords[coords.length-1];
|
97
|
+
return 'v'+coords.join(',');
|
98
|
+
break;
|
99
|
+
case 'S':
|
100
|
+
coords.unshift(cy+cy-ctrly);
|
101
|
+
coords.unshift(cx+cx-ctrlx);
|
102
|
+
ctrlx = coords[coords.length-4];
|
103
|
+
ctrly = coords[coords.length-3];
|
104
|
+
cx = coords[coords.length-2];
|
105
|
+
cy = coords[coords.length-1];
|
106
|
+
return 'c'+coords.join(',');
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
return '';
|
110
|
+
}).replace(/z/g, 'e');
|
111
|
+
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
jvm.VMLShapeElement = function(name, config){
|
2
|
+
jvm.VMLShapeElement.parentClass.call(this, name, config);
|
3
|
+
|
4
|
+
this.fillElement = new jvm.VMLElement('fill');
|
5
|
+
this.strokeElement = new jvm.VMLElement('stroke');
|
6
|
+
this.node.appendChild(this.fillElement.node);
|
7
|
+
this.node.appendChild(this.strokeElement.node);
|
8
|
+
this.node.stroked = false;
|
9
|
+
|
10
|
+
jvm.AbstractShapeElement.apply(this, arguments);
|
11
|
+
};
|
12
|
+
|
13
|
+
jvm.inherits(jvm.VMLShapeElement, jvm.VMLElement);
|
14
|
+
jvm.mixin(jvm.VMLShapeElement, jvm.AbstractShapeElement);
|
15
|
+
|
16
|
+
jvm.VMLShapeElement.prototype.applyAttr = function(attr, value){
|
17
|
+
switch (attr) {
|
18
|
+
case 'fill':
|
19
|
+
this.node.fillcolor = value;
|
20
|
+
break;
|
21
|
+
case 'fill-opacity':
|
22
|
+
this.fillElement.node.opacity = Math.round(value*100)+'%';
|
23
|
+
break;
|
24
|
+
case 'stroke':
|
25
|
+
if (value === 'none') {
|
26
|
+
this.node.stroked = false;
|
27
|
+
} else {
|
28
|
+
this.node.stroked = true;
|
29
|
+
}
|
30
|
+
this.node.strokecolor = value;
|
31
|
+
break;
|
32
|
+
case 'stroke-opacity':
|
33
|
+
this.strokeElement.node.opacity = Math.round(value*100)+'%';
|
34
|
+
break;
|
35
|
+
case 'stroke-width':
|
36
|
+
if (parseInt(value, 10) === 0) {
|
37
|
+
this.node.stroked = false;
|
38
|
+
} else {
|
39
|
+
this.node.stroked = true;
|
40
|
+
}
|
41
|
+
this.node.strokeweight = value;
|
42
|
+
break;
|
43
|
+
case 'd':
|
44
|
+
this.node.path = jvm.VMLPathElement.pathSvgToVml(value);
|
45
|
+
break;
|
46
|
+
default:
|
47
|
+
jvm.VMLShapeElement.parentClass.prototype.applyAttr.apply(this, arguments);
|
48
|
+
}
|
49
|
+
};
|