fix derive file style in constructor
This commit is contained in:
parent
72b0b5a706
commit
ca51e1d788
1 changed files with 15 additions and 16 deletions
|
@ -133,22 +133,21 @@ export class GPXFile extends GPXTreeNode<Track> {
|
||||||
}
|
}
|
||||||
if (gpx.hasOwnProperty('_data')) {
|
if (gpx.hasOwnProperty('_data')) {
|
||||||
this._data = gpx._data;
|
this._data = gpx._data;
|
||||||
|
}
|
||||||
if (!this._data.hasOwnProperty('style')) {
|
if (!this._data.hasOwnProperty('style')) {
|
||||||
let style = this.getStyle();
|
let style = this.getStyle();
|
||||||
let fileStyle = {};
|
let fileStyle = {};
|
||||||
if (style.color.length === 1) {
|
if (style.color.length === 1) {
|
||||||
fileStyle['color'] = style.color[0];
|
fileStyle['color'] = style.color[0];
|
||||||
}
|
}
|
||||||
if (style.weight.length === 1) {
|
if (style.weight.length === 1) {
|
||||||
fileStyle['weight'] = style.weight[0];
|
fileStyle['weight'] = style.weight[0];
|
||||||
}
|
}
|
||||||
if (style.opacity.length === 1) {
|
if (style.opacity.length === 1) {
|
||||||
fileStyle['opacity'] = style.opacity[0];
|
fileStyle['opacity'] = style.opacity[0];
|
||||||
}
|
}
|
||||||
if (Object.keys(fileStyle).length > 0) {
|
if (Object.keys(fileStyle).length > 0) {
|
||||||
this.setStyle(fileStyle);
|
this.setStyle(fileStyle);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue