Rename _ol_style_IconOrigin_ to IconOrigin
This commit is contained in:
@@ -23,7 +23,7 @@ import {get as getProjection} from '../proj.js';
|
||||
import _ol_style_Fill_ from '../style/Fill.js';
|
||||
import _ol_style_Icon_ from '../style/Icon.js';
|
||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
||||
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
|
||||
import IconOrigin from '../style/IconOrigin.js';
|
||||
import _ol_style_Stroke_ from '../style/Stroke.js';
|
||||
import _ol_style_Style_ from '../style/Style.js';
|
||||
import _ol_style_Text_ from '../style/Text.js';
|
||||
@@ -201,7 +201,7 @@ KML.createStyleDefaults_ = function() {
|
||||
*/
|
||||
KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({
|
||||
anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
|
||||
anchorOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
|
||||
anchorOrigin: IconOrigin.BOTTOM_LEFT,
|
||||
anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
|
||||
anchorYUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
|
||||
crossOrigin: 'anonymous',
|
||||
@@ -509,15 +509,15 @@ KML.readVec2_ = function(node) {
|
||||
var origin;
|
||||
if (xunits !== 'insetPixels') {
|
||||
if (yunits !== 'insetPixels') {
|
||||
origin = _ol_style_IconOrigin_.BOTTOM_LEFT;
|
||||
origin = IconOrigin.BOTTOM_LEFT;
|
||||
} else {
|
||||
origin = _ol_style_IconOrigin_.TOP_LEFT;
|
||||
origin = IconOrigin.TOP_LEFT;
|
||||
}
|
||||
} else {
|
||||
if (yunits !== 'insetPixels') {
|
||||
origin = _ol_style_IconOrigin_.BOTTOM_RIGHT;
|
||||
origin = IconOrigin.BOTTOM_RIGHT;
|
||||
} else {
|
||||
origin = _ol_style_IconOrigin_.TOP_RIGHT;
|
||||
origin = IconOrigin.TOP_RIGHT;
|
||||
}
|
||||
}
|
||||
return {
|
||||
@@ -579,7 +579,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
||||
src = KML.DEFAULT_IMAGE_STYLE_SRC_;
|
||||
}
|
||||
var anchor, anchorXUnits, anchorYUnits;
|
||||
var anchorOrigin = _ol_style_IconOrigin_.BOTTOM_LEFT;
|
||||
var anchorOrigin = IconOrigin.BOTTOM_LEFT;
|
||||
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
|
||||
(object['hotSpot']);
|
||||
if (hotSpot) {
|
||||
@@ -640,7 +640,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
||||
anchorYUnits: anchorYUnits,
|
||||
crossOrigin: 'anonymous', // FIXME should this be configurable?
|
||||
offset: offset,
|
||||
offsetOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
|
||||
offsetOrigin: IconOrigin.BOTTOM_LEFT,
|
||||
rotation: rotation,
|
||||
scale: scale,
|
||||
size: size,
|
||||
|
||||
@@ -9,7 +9,7 @@ import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
||||
import _ol_style_IconImage_ from '../style/IconImage.js';
|
||||
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
|
||||
import IconOrigin from '../style/IconOrigin.js';
|
||||
import _ol_style_Image_ from '../style/Image.js';
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ var _ol_style_Icon_ = function(opt_options) {
|
||||
* @type {ol.style.IconOrigin}
|
||||
*/
|
||||
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
||||
options.anchorOrigin : _ol_style_IconOrigin_.TOP_LEFT;
|
||||
options.anchorOrigin : IconOrigin.TOP_LEFT;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -122,7 +122,7 @@ var _ol_style_Icon_ = function(opt_options) {
|
||||
* @type {ol.style.IconOrigin}
|
||||
*/
|
||||
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
||||
options.offsetOrigin : _ol_style_IconOrigin_.TOP_LEFT;
|
||||
options.offsetOrigin : IconOrigin.TOP_LEFT;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -226,19 +226,19 @@ _ol_style_Icon_.prototype.getAnchor = function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.anchorOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
|
||||
if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {
|
||||
if (!size) {
|
||||
return null;
|
||||
}
|
||||
if (anchor === this.anchor_) {
|
||||
anchor = this.anchor_.slice();
|
||||
}
|
||||
if (this.anchorOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
|
||||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
||||
if (this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
anchor[0] = -anchor[0] + size[0];
|
||||
}
|
||||
if (this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
|
||||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
||||
if (this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
anchor[1] = -anchor[1] + size[1];
|
||||
}
|
||||
}
|
||||
@@ -311,19 +311,19 @@ _ol_style_Icon_.prototype.getOrigin = function() {
|
||||
}
|
||||
var offset = this.offset_;
|
||||
|
||||
if (this.offsetOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
|
||||
if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
|
||||
var size = this.getSize();
|
||||
var iconImageSize = this.iconImage_.getSize();
|
||||
if (!size || !iconImageSize) {
|
||||
return null;
|
||||
}
|
||||
offset = offset.slice();
|
||||
if (this.offsetOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
|
||||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
||||
if (this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
||||
}
|
||||
if (this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
|
||||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
||||
if (this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||
import _ol_style_IconAnchorUnits_ from '../../../../src/ol/style/IconAnchorUnits.js';
|
||||
import _ol_style_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_Style_ from '../../../../src/ol/style/Style.js';
|
||||
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
|
||||
@@ -1843,7 +1843,7 @@ describe('ol.format.KML', function() {
|
||||
if (f.getId() == 1) {
|
||||
expect(imageStyle.anchor_[0]).to.be(0.5);
|
||||
expect(imageStyle.anchor_[1]).to.be(0.5);
|
||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_LEFT);
|
||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
||||
} else {
|
||||
@@ -1852,16 +1852,16 @@ describe('ol.format.KML', function() {
|
||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
||||
if (f.getId() == 2) {
|
||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_LEFT);
|
||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
||||
}
|
||||
if (f.getId() == 3) {
|
||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_RIGHT);
|
||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_RIGHT);
|
||||
}
|
||||
if (f.getId() == 4) {
|
||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.TOP_LEFT);
|
||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.TOP_LEFT);
|
||||
}
|
||||
if (f.getId() == 5) {
|
||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.TOP_RIGHT);
|
||||
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.TOP_RIGHT);
|
||||
}
|
||||
}
|
||||
expect(imageStyle.getRotation()).to.eql(0);
|
||||
|
||||
Reference in New Issue
Block a user