mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-01 08:12:32 +00:00
fix tab color when all tracks have a different one
This commit is contained in:
@@ -185,19 +185,19 @@ export class GPXFile extends GPXTreeNode<Track> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getStyle(): MergedLineStyles {
|
getStyle(defaultColor?: string): MergedLineStyles {
|
||||||
return this.trk.map((track) => track.getStyle()).reduce((acc, style) => {
|
return this.trk.map((track) => track.getStyle()).reduce((acc, style) => {
|
||||||
if (style) {
|
if (style && style["gpx_style:color"] && !acc.color.includes(style["gpx_style:color"])) {
|
||||||
if (style["gpx_style:color"] && !acc.color.includes(style["gpx_style:color"])) {
|
|
||||||
acc.color.push(style["gpx_style:color"]);
|
acc.color.push(style["gpx_style:color"]);
|
||||||
|
} else if (defaultColor && !acc.color.includes(defaultColor)) {
|
||||||
|
acc.color.push(defaultColor);
|
||||||
}
|
}
|
||||||
if (style["gpx_style:opacity"] && !acc.opacity.includes(style["gpx_style:opacity"])) {
|
if (style && style["gpx_style:opacity"] && !acc.opacity.includes(style["gpx_style:opacity"])) {
|
||||||
acc.opacity.push(style["gpx_style:opacity"]);
|
acc.opacity.push(style["gpx_style:opacity"]);
|
||||||
}
|
}
|
||||||
if (style["gpx_style:width"] && !acc.width.includes(style["gpx_style:width"])) {
|
if (style && style["gpx_style:width"] && !acc.width.includes(style["gpx_style:width"])) {
|
||||||
acc.width.push(style["gpx_style:width"]);
|
acc.width.push(style["gpx_style:width"]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {
|
}, {
|
||||||
color: [],
|
color: [],
|
||||||
|
@@ -69,13 +69,14 @@
|
|||||||
nodeColors = [];
|
nodeColors = [];
|
||||||
|
|
||||||
if (node instanceof GPXFile) {
|
if (node instanceof GPXFile) {
|
||||||
let style = node.getStyle();
|
let defaultColor = undefined;
|
||||||
|
|
||||||
let layer = gpxLayers.get(item.getFileId());
|
let layer = gpxLayers.get(item.getFileId());
|
||||||
if (layer) {
|
if (layer) {
|
||||||
style.color.push(layer.layerColor);
|
defaultColor = layer.layerColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let style = node.getStyle(defaultColor);
|
||||||
style.color.forEach((c) => {
|
style.color.forEach((c) => {
|
||||||
if (!nodeColors.includes(c)) {
|
if (!nodeColors.includes(c)) {
|
||||||
nodeColors.push(c);
|
nodeColors.push(c);
|
||||||
|
Reference in New Issue
Block a user