Skip to content

Commit 9446c73

Browse files
committed
fix enums anychart.onDocumentReady(function() {
1 parent 9de8aa8 commit 9446c73

File tree

2 files changed

+54
-10
lines changed

2 files changed

+54
-10
lines changed

src/vector/Image.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,55 +95,55 @@ acgraph.vector.Image.Align = {
9595
Align the <min-x> of the element's ‘viewBox’ with the smallest X value of the viewport.
9696
Align the <min-y> of the element's ‘viewBox’ with the smallest Y value of the viewport.
9797
*/
98-
X_MIN_Y_MIN: 'xMinYMin',
98+
X_MIN_Y_MIN: 'x-min-y-min',
9999
/**
100100
* Force uniform scaling.
101101
Align the midpoint X value of the element's ‘viewBox’ with the midpoint X value of the viewport.
102102
Align the <min-y> of the element's ‘viewBox’ with the smallest Y value of the viewport.
103103
*/
104-
X_MID_Y_MIN: 'xMidYMin',
104+
X_MID_Y_MIN: 'x-mid-y-min',
105105
/**
106106
* Force uniform scaling.
107107
Align the <min-x>+<width> of the element's ‘viewBox’ with the maximum X value of the viewport.
108108
Align the <min-y> of the element's ‘viewBox’ with the smallest Y value of the viewport.
109109
*/
110-
X_MAX_Y_MIN: 'xMaxYMin',
110+
X_MAX_Y_MIN: 'x-max-y-min',
111111
/**
112112
* Force uniform scaling.
113113
Align the <min-x> of the element's ‘viewBox’ with the smallest X value of the viewport.
114114
Align the midpoint Y value of the element's ‘viewBox’ with the midpoint Y value of the viewport.
115115
*/
116-
X_MIN_Y_MID: 'xMinYMid',
116+
X_MIN_Y_MID: 'x-min-y-mid',
117117
/**
118118
* Force uniform scaling.
119119
Align the midpoint X value of the element's ‘viewBox’ with the midpoint X value of the viewport.
120120
Align the midpoint Y value of the element's ‘viewBox’ with the midpoint Y value of the viewport.
121121
*/
122-
X_MID_Y_MID: 'xMidYMid',
122+
X_MID_Y_MID: 'x-mid-y-mid',
123123
/**
124124
* Force uniform scaling.
125125
Align the <min-x>+<width> of the element's ‘viewBox’ with the maximum X value of the viewport.
126126
Align the midpoint Y value of the element's ‘viewBox’ with the midpoint Y value of the viewport.
127127
*/
128-
X_MAX_Y_MID: 'xMaxYMid',
128+
X_MAX_Y_MID: 'x-max-y-mid',
129129
/**
130130
* Force uniform scaling.
131131
Align the <min-x> of the element's ‘viewBox’ with the smallest X value of the viewport.
132132
Align the <min-y>+<height> of the element's ‘viewBox’ with the maximum Y value of the viewport.
133133
*/
134-
X_MIN_Y_MAX: 'xMinYMax',
134+
X_MIN_Y_MAX: 'x-min-y-max',
135135
/**
136136
* Force uniform scaling.
137137
Align the midpoint X value of the element's ‘viewBox’ with the midpoint X value of the viewport.
138138
Align the <min-y>+<height> of the element's ‘viewBox’ with the maximum Y value of the viewport.
139139
*/
140-
X_MID_Y_MAX: 'xMidYMax',
140+
X_MID_Y_MAX: 'x-mid-y-max',
141141
/**
142142
* Force uniform scaling.
143143
Align the <min-x>+<width> of the element's ‘viewBox’ with the maximum X value of the viewport.
144144
Align the <min-y>+<height> of the element's ‘viewBox’ with the maximum Y value of the viewport.
145145
*/
146-
X_MAX_Y_MAX: 'xMaxYMax'
146+
X_MAX_Y_MAX: 'x-max-y-max'
147147
};
148148

149149

src/vector/svg/Renderer.js

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,50 @@ acgraph.vector.svg.Renderer.prototype.setFillPatternProperties = function(elemen
639639
};
640640

641641

642+
/**
643+
* Creates and returns normalized preserveAspectRatio.
644+
* @param {!acgraph.vector.Image} element
645+
* @return {string}
646+
*/
647+
acgraph.vector.svg.Renderer.prototype.getPreserveAspectRatio = function(element) {
648+
var align;
649+
switch (element.align()) {
650+
case 'x-min-y-min':
651+
align = 'xMinYMin';
652+
break;
653+
case 'x-mid-y-min':
654+
align = 'xMidYMin';
655+
break;
656+
case 'x-max-y-min':
657+
align = 'xMaxYMin';
658+
break;
659+
case 'x-min-y-mid':
660+
align = 'xMinYMid';
661+
break;
662+
case 'x-mid-y-mid':
663+
align = 'xMidYMid';
664+
break;
665+
case 'x-max-y-mid':
666+
align = 'xMaxYMid';
667+
break;
668+
case 'x-min-y-max':
669+
align = 'xMinYMax';
670+
break;
671+
case 'x-mid-y-max':
672+
align = 'xMidYMax';
673+
break;
674+
case 'x-max-y-max':
675+
align = 'xMaxYMax';
676+
break;
677+
case 'none':
678+
default:
679+
align = 'none';
680+
}
681+
682+
return align + ' ' + element.fittingMode();
683+
};
684+
685+
642686
/** @inheritDoc */
643687
acgraph.vector.svg.Renderer.prototype.setImageProperties = function(element) {
644688
var bounds = element.getBoundsWithoutTransform();
@@ -656,7 +700,7 @@ acgraph.vector.svg.Renderer.prototype.setImageProperties = function(element) {
656700
'width': bounds.width,
657701
'height': bounds.height,
658702
'image-rendering': 'optimizeQuality',
659-
'preserveAspectRatio': element.align() + ' ' + element.fittingMode(),
703+
'preserveAspectRatio': this.getPreserveAspectRatio(element),
660704
'opacity': element.opacity()
661705
});
662706

0 commit comments

Comments
 (0)