Merge pull request #9909 from oterral/padding

Clone the text's padding
This commit is contained in:
Tim Schaub
2019-09-06 07:19:00 -06:00
committed by GitHub
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -184,7 +184,8 @@ class Text {
offsetX: this.getOffsetX(), offsetX: this.getOffsetX(),
offsetY: this.getOffsetY(), offsetY: this.getOffsetY(),
backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined, backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined,
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined,
padding: this.getPadding()
}); });
} }
+3 -1
View File
@@ -58,7 +58,8 @@ describe('ol.style.Text', function() {
}), }),
backgroundStroke: new Stroke({ backgroundStroke: new Stroke({
color: 'black' color: 'black'
}) }),
padding: [10, 11, 12, 13]
}); });
const clone = original.clone(); const clone = original.clone();
expect(original.getFont()).to.eql(clone.getFont()); expect(original.getFont()).to.eql(clone.getFont());
@@ -74,6 +75,7 @@ describe('ol.style.Text', function() {
expect(original.getFill().getColor()).to.eql(clone.getFill().getColor()); expect(original.getFill().getColor()).to.eql(clone.getFill().getColor());
expect(original.getBackgroundStroke().getColor()).to.eql(clone.getBackgroundStroke().getColor()); expect(original.getBackgroundStroke().getColor()).to.eql(clone.getBackgroundStroke().getColor());
expect(original.getBackgroundFill().getColor()).to.eql(clone.getBackgroundFill().getColor()); expect(original.getBackgroundFill().getColor()).to.eql(clone.getBackgroundFill().getColor());
expect(original.getPadding()).to.eql(clone.getPadding());
}); });
it('the clone does not reference the same objects as the original', function() { it('the clone does not reference the same objects as the original', function() {