Clone the text's padding

This commit is contained in:
Olivier Terral
2019-09-06 12:16:04 +02:00
parent 5bff4c051e
commit 7c9ebf8b1b
2 changed files with 5 additions and 2 deletions

View File

@@ -184,7 +184,8 @@ class Text {
offsetX: this.getOffsetX(),
offsetY: this.getOffsetY(),
backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined,
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined,
padding: this.getPadding()
});
}

View File

@@ -58,7 +58,8 @@ describe('ol.style.Text', function() {
}),
backgroundStroke: new Stroke({
color: 'black'
})
}),
padding: [10, 11, 12, 13]
});
const clone = original.clone();
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.getBackgroundStroke().getColor()).to.eql(clone.getBackgroundStroke().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() {