forked from MapComplete/MapComplete
Fix bug in presets which generated incorrect 'referencingWays'
This commit is contained in:
parent
753efef38f
commit
96c819ea40
3 changed files with 8 additions and 4 deletions
|
@ -69,7 +69,7 @@ export class ReferencingWaysMetaTagger extends SimpleMetaTagger {
|
||||||
{
|
{
|
||||||
keys: ["_referencing_ways"],
|
keys: ["_referencing_ways"],
|
||||||
isLazy: true,
|
isLazy: true,
|
||||||
doc: "_referencing_ways contains - for a node - which ways use this this node as point in their geometry. If the preset has 'snapToLayer' defined, the icon will be calculated based on the preset tags with `_referencing_ways=[way/-1]` added.",
|
doc: "_referencing_ways contains - for a node - which ways use this this node as point in their geometry. If the preset has 'snapToLayer' defined, the icon will be calculated based on the preset tags with `_referencing_ways=[\"way/-1\"]` added.",
|
||||||
},
|
},
|
||||||
(feature, _, __, state) => {
|
(feature, _, __, state) => {
|
||||||
if (!ReferencingWaysMetaTagger.enabled) {
|
if (!ReferencingWaysMetaTagger.enabled) {
|
||||||
|
|
|
@ -25,6 +25,10 @@ export class RegexTag extends TagsFilter {
|
||||||
if (typeof possibleRegex === "string") {
|
if (typeof possibleRegex === "string") {
|
||||||
return fromTag === possibleRegex
|
return fromTag === possibleRegex
|
||||||
}
|
}
|
||||||
|
if (typeof fromTag.match !== "function") {
|
||||||
|
console.error("Error: fromTag is not a regex: ", fromTag, possibleRegex)
|
||||||
|
throw "Error: fromTag is not a regex: " + fromTag + possibleRegex
|
||||||
|
}
|
||||||
return fromTag.match(possibleRegex) !== null
|
return fromTag.match(possibleRegex) !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import BaseLayer from "../../Models/BaseLayer"
|
||||||
import Loading from "../Base/Loading"
|
import Loading from "../Base/Loading"
|
||||||
import Hash from "../../Logic/Web/Hash"
|
import Hash from "../../Logic/Web/Hash"
|
||||||
import { GlobalFilter } from "../../Logic/State/MapState"
|
import { GlobalFilter } from "../../Logic/State/MapState"
|
||||||
import { WayId } from "../../Models/OsmFeature"
|
import { OsmTags, WayId } from "../../Models/OsmFeature"
|
||||||
import { Tag } from "../../Logic/Tags/Tag"
|
import { Tag } from "../../Logic/Tags/Tag"
|
||||||
import { LoginToggle } from "../Popup/LoginButton"
|
import { LoginToggle } from "../Popup/LoginButton"
|
||||||
|
|
||||||
|
@ -290,8 +290,8 @@ export default class SimpleAddUI extends LoginToggle {
|
||||||
let icon: () => BaseUIElement = () =>
|
let icon: () => BaseUIElement = () =>
|
||||||
layer.layerDef.mapRendering[0]
|
layer.layerDef.mapRendering[0]
|
||||||
.GenerateLeafletStyle(
|
.GenerateLeafletStyle(
|
||||||
new ImmutableStore<any>(
|
new ImmutableStore<OsmTags>(
|
||||||
isSnapping ? tags : { _referencing_ways: ["way/-1"], ...tags }
|
isSnapping ? tags : { _referencing_ways: '["way/-1"]', ...tags }
|
||||||
),
|
),
|
||||||
false,
|
false,
|
||||||
{ noSize: true }
|
{ noSize: true }
|
||||||
|
|
Loading…
Reference in a new issue