Added remaining tests

This commit is contained in:
Simon Seyock
2016-09-10 22:34:04 +02:00
parent 9f32e8d566
commit b86a12e121
9 changed files with 298 additions and 26 deletions

View File

@@ -163,9 +163,8 @@ ol.style.RegularShape.prototype.clone = function() {
rotateWithView: this.getRotateWithView(),
atlasManager: this.atlasManager_
});
this.setOpacity(this.getOpacity());
this.setScale(this.getScale());
style.setOpacity(this.getOpacity());
style.setScale(this.getScale());
return style;
};
@@ -432,11 +431,12 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
context.translate(x, y);
context.beginPath();
var points = this.points_;
if (this.radius2_ !== this.radius_) {
this.points_ = 2 * this.points_;
points = 2 * points;
}
for (i = 0; i <= this.points_; i++) {
angle0 = i * 2 * Math.PI / this.points_ - Math.PI / 2 + this.angle_;
for (i = 0; i <= points; i++) {
angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_;
radiusC = i % 2 === 0 ? this.radius_ : this.radius2_;
context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0),
renderOptions.size / 2 + radiusC * Math.sin(angle0));
@@ -496,12 +496,13 @@ ol.style.RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions
context.translate(x, y);
context.beginPath();
var points = this.points_;
if (this.radius2_ !== this.radius_) {
this.points_ = 2 * this.points_;
points = 2 * points;
}
var i, radiusC, angle0;
for (i = 0; i <= this.points_; i++) {
angle0 = i * 2 * Math.PI / this.points_ - Math.PI / 2 + this.angle_;
for (i = 0; i <= points; i++) {
angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_;
radiusC = i % 2 === 0 ? this.radius_ : this.radius2_;
context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0),
renderOptions.size / 2 + radiusC * Math.sin(angle0));