diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 88120983e..f9ec9fae3 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -140,8 +140,8 @@ export class GPXFile extends GPXTreeNode { if (style.color.length === 1) { fileStyle['gpx_style:color'] = style.color[0]; } - if (style.weight.length === 1) { - fileStyle['gpx_style:weight'] = style.weight[0]; + if (style.width.length === 1) { + fileStyle['gpx_style:width'] = style.width[0]; } if (style.opacity.length === 1) { fileStyle['gpx_style:opacity'] = style.opacity[0]; @@ -194,15 +194,15 @@ export class GPXFile extends GPXTreeNode { if (style["gpx_style:opacity"] && !acc.opacity.includes(style["gpx_style:opacity"])) { acc.opacity.push(style["gpx_style:opacity"]); } - if (style["gpx_style:weight"] && !acc.weight.includes(style["gpx_style:weight"])) { - acc.weight.push(style["gpx_style:weight"]); + if (style["gpx_style:width"] && !acc.width.includes(style["gpx_style:width"])) { + acc.width.push(style["gpx_style:width"]); } } return acc; }, { color: [], opacity: [], - weight: [] + width: [] }); } @@ -405,8 +405,8 @@ export class GPXFile extends GPXTreeNode { if (style["gpx_style:opacity"]) { this._data.style.opacity = style["gpx_style:opacity"]; } - if (style["gpx_style:weight"]) { - this._data.style.weight = style["gpx_style:weight"]; + if (style["gpx_style:width"]) { + this._data.style.width = style["gpx_style:width"]; } } @@ -527,8 +527,8 @@ export class Track extends GPXTreeNode { if (this.extensions['gpx_style:line']["gpx_style:opacity"]) { geoJSON.properties['opacity'] = this.extensions['gpx_style:line']["gpx_style:opacity"]; } - if (this.extensions['gpx_style:line']["gpx_style:weight"]) { - geoJSON.properties['weight'] = this.extensions['gpx_style:line']["gpx_style:weight"]; + if (this.extensions['gpx_style:line']["gpx_style:width"]) { + geoJSON.properties['width'] = this.extensions['gpx_style:line']["gpx_style:width"]; } } return geoJSON; @@ -647,8 +647,8 @@ export class Track extends GPXTreeNode { if (style["gpx_style:opacity"] !== undefined && (force || this.extensions['gpx_style:line']["gpx_style:opacity"] === undefined)) { this.extensions['gpx_style:line']["gpx_style:opacity"] = style["gpx_style:opacity"]; } - if (style["gpx_style:weight"] !== undefined && (force || this.extensions['gpx_style:line']["gpx_style:weight"] === undefined)) { - this.extensions['gpx_style:line']["gpx_style:weight"] = style["gpx_style:weight"]; + if (style["gpx_style:width"] !== undefined && (force || this.extensions['gpx_style:line']["gpx_style:width"] === undefined)) { + this.extensions['gpx_style:line']["gpx_style:width"] = style["gpx_style:width"]; } } @@ -1632,7 +1632,7 @@ function getOriginal(obj: any): any { export type MergedLineStyles = { color: string[] opacity: number[], - weight: number[], + width: number[], }; function convertRouteToTrack(route: RouteType): Track { diff --git a/gpx/src/io.ts b/gpx/src/io.ts index 99db761e0..405a41b29 100644 --- a/gpx/src/io.ts +++ b/gpx/src/io.ts @@ -35,7 +35,7 @@ export function parseGPX(gpxData: string): GPXFile { } if (tagName === 'gpxtpx:atemp' || tagName === 'gpxtpx:hr' || tagName === 'gpxtpx:cad' || tagName === 'gpxpx:PowerInWatts' || - tagName === 'gpx_style:opacity' || tagName === 'gpx_style:weight') { + tagName === 'gpx_style:opacity' || tagName === 'gpx_style:width') { return parseFloat(tagValue); } diff --git a/gpx/src/types.ts b/gpx/src/types.ts index f21c9b32d..a7bd5cb1d 100644 --- a/gpx/src/types.ts +++ b/gpx/src/types.ts @@ -69,7 +69,7 @@ export type TrackExtensions = { export type LineStyleExtension = { 'gpx_style:color'?: string; 'gpx_style:opacity'?: number; - 'gpx_style:weight'?: number; + 'gpx_style:width'?: number; }; export type TrackSegmentType = { diff --git a/gpx/test-data/with_style.gpx b/gpx/test-data/with_style.gpx index e027eaca7..98b5e7fc4 100644 --- a/gpx/test-data/with_style.gpx +++ b/gpx/test-data/with_style.gpx @@ -18,7 +18,7 @@ 2d3ee9 0.5 - 6 + 6 diff --git a/website/src/lib/components/file-list/StyleDialog.svelte b/website/src/lib/components/file-list/StyleDialog.svelte index 4521ae1c1..535a8e65d 100644 --- a/website/src/lib/components/file-list/StyleDialog.svelte +++ b/website/src/lib/components/file-list/StyleDialog.svelte @@ -14,20 +14,20 @@ export let item: ListItem; export let open = false; - const { defaultOpacity, defaultWeight } = settings; + const { defaultOpacity, defaultWidth } = settings; let colors: string[] = []; let color: string | undefined = undefined; let opacity: number[] = []; - let weight: number[] = []; + let width: number[] = []; let colorChanged = false; let opacityChanged = false; - let weightChanged = false; + let widthChanged = false; function setStyleInputs() { colors = []; opacity = []; - weight = []; + width = []; $selection.forEach((item) => { if (item instanceof ListFileItem) { @@ -47,9 +47,9 @@ opacity.push(o); } }); - style.weight.forEach((w) => { - if (!weight.includes(w)) { - weight.push(w); + style.width.forEach((w) => { + if (!width.includes(w)) { + width.push(w); } }); } @@ -66,8 +66,8 @@ if (style['gpx_style:opacity'] && !opacity.includes(style['gpx_style:opacity'])) { opacity.push(style['gpx_style:opacity']); } - if (style['gpx_style:weight'] && !weight.includes(style['gpx_style:weight'])) { - weight.push(style['gpx_style:weight']); + if (style['gpx_style:width'] && !width.includes(style['gpx_style:width'])) { + width.push(style['gpx_style:width']); } } if (!colors.includes(layer.layerColor)) { @@ -79,11 +79,11 @@ color = colors[0]; opacity = [opacity[0] ?? $defaultOpacity]; - weight = [weight[0] ?? $defaultWeight]; + width = [width[0] ?? $defaultWidth]; colorChanged = false; opacityChanged = false; - weightChanged = false; + widthChanged = false; } $: if ($selection && open) { @@ -123,18 +123,18 @@ {$_('menu.style.width')}
(weightChanged = true)} + onValueChange={() => (widthChanged = true)} />