Rename _ol_style_IconAnchorUnits_ to IconAnchorUnits
This commit is contained in:
+10
-12
@@ -22,7 +22,7 @@ import _ol_math_ from '../math.js';
|
|||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import _ol_style_Fill_ from '../style/Fill.js';
|
import _ol_style_Fill_ from '../style/Fill.js';
|
||||||
import _ol_style_Icon_ from '../style/Icon.js';
|
import _ol_style_Icon_ from '../style/Icon.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../style/IconAnchorUnits.js';
|
||||||
import IconOrigin from '../style/IconOrigin.js';
|
import IconOrigin from '../style/IconOrigin.js';
|
||||||
import _ol_style_Stroke_ from '../style/Stroke.js';
|
import _ol_style_Stroke_ from '../style/Stroke.js';
|
||||||
import _ol_style_Style_ from '../style/Style.js';
|
import _ol_style_Style_ from '../style/Style.js';
|
||||||
@@ -161,16 +161,14 @@ KML.createStyleDefaults_ = function() {
|
|||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
|
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = IconAnchorUnits.PIXELS;
|
||||||
_ol_style_IconAnchorUnits_.PIXELS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
|
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = IconAnchorUnits.PIXELS;
|
||||||
_ol_style_IconAnchorUnits_.PIXELS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
@@ -280,9 +278,9 @@ KML.createStyleDefaults_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.ICON_ANCHOR_UNITS_MAP_ = {
|
KML.ICON_ANCHOR_UNITS_MAP_ = {
|
||||||
'fraction': _ol_style_IconAnchorUnits_.FRACTION,
|
'fraction': IconAnchorUnits.FRACTION,
|
||||||
'pixels': _ol_style_IconAnchorUnits_.PIXELS,
|
'pixels': IconAnchorUnits.PIXELS,
|
||||||
'insetPixels': _ol_style_IconAnchorUnits_.PIXELS
|
'insetPixels': IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -593,8 +591,8 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
||||||
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
||||||
anchor = [0.5, 0];
|
anchor = [0.5, 0];
|
||||||
anchorXUnits = _ol_style_IconAnchorUnits_.FRACTION;
|
anchorXUnits = IconAnchorUnits.FRACTION;
|
||||||
anchorYUnits = _ol_style_IconAnchorUnits_.FRACTION;
|
anchorYUnits = IconAnchorUnits.FRACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
var offset;
|
var offset;
|
||||||
@@ -2279,9 +2277,9 @@ KML.writeIconStyle_ = function(node, style, objectStack) {
|
|||||||
if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
|
if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
|
||||||
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
||||||
x: anchor[0],
|
x: anchor[0],
|
||||||
xunits: _ol_style_IconAnchorUnits_.PIXELS,
|
xunits: IconAnchorUnits.PIXELS,
|
||||||
y: size[1] - anchor[1],
|
y: size[1] - anchor[1],
|
||||||
yunits: _ol_style_IconAnchorUnits_.PIXELS
|
yunits: IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
properties['hotSpot'] = hotSpot;
|
properties['hotSpot'] = hotSpot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {assert} from '../asserts.js';
|
|||||||
import _ol_color_ from '../color.js';
|
import _ol_color_ from '../color.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../style/IconAnchorUnits.js';
|
||||||
import _ol_style_IconImage_ from '../style/IconImage.js';
|
import _ol_style_IconImage_ from '../style/IconImage.js';
|
||||||
import IconOrigin from '../style/IconOrigin.js';
|
import IconOrigin from '../style/IconOrigin.js';
|
||||||
import _ol_style_Image_ from '../style/Image.js';
|
import _ol_style_Image_ from '../style/Image.js';
|
||||||
@@ -49,14 +49,14 @@ var _ol_style_Icon_ = function(opt_options) {
|
|||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
||||||
options.anchorXUnits : _ol_style_IconAnchorUnits_.FRACTION;
|
options.anchorXUnits : IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
||||||
options.anchorYUnits : _ol_style_IconAnchorUnits_.FRACTION;
|
options.anchorYUnits : IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -212,16 +212,16 @@ _ol_style_Icon_.prototype.getAnchor = function() {
|
|||||||
}
|
}
|
||||||
var anchor = this.anchor_;
|
var anchor = this.anchor_;
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION ||
|
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION ||
|
||||||
this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
anchor = this.anchor_.slice();
|
anchor = this.anchor_.slice();
|
||||||
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
anchor[0] *= size[0];
|
anchor[0] *= size[0];
|
||||||
}
|
}
|
||||||
if (this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
anchor[1] *= size[1];
|
anchor[1] *= size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {remove as removeTransform} from '../../../../src/ol/proj/transforms.js';
|
|||||||
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||||
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
||||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../../../../src/ol/style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js';
|
||||||
import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
|
import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
|
||||||
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
|
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
|
||||||
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
||||||
@@ -1844,13 +1844,13 @@ describe('ol.format.KML', function() {
|
|||||||
expect(imageStyle.anchor_[0]).to.be(0.5);
|
expect(imageStyle.anchor_[0]).to.be(0.5);
|
||||||
expect(imageStyle.anchor_[1]).to.be(0.5);
|
expect(imageStyle.anchor_[1]).to.be(0.5);
|
||||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
||||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.FRACTION);
|
||||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.FRACTION);
|
||||||
} else {
|
} else {
|
||||||
expect(imageStyle.anchor_[0]).to.be(5);
|
expect(imageStyle.anchor_[0]).to.be(5);
|
||||||
expect(imageStyle.anchor_[1]).to.be(5);
|
expect(imageStyle.anchor_[1]).to.be(5);
|
||||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.PIXELS);
|
||||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.PIXELS);
|
||||||
if (f.getId() == 2) {
|
if (f.getId() == 2) {
|
||||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user