Skip to content

Commit

Permalink
fix: offset Y for Textsymbolizer (#932)
Browse files Browse the repository at this point in the history
* fix: offset y for textsymbolizer #566

* fix: few tests changed
  • Loading branch information
pprev94 authored and jansule committed Jun 21, 2024
1 parent e01c8c8 commit 398ce0c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data/styles/geoserver/poi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const style: Style = {
haloColor: '#FFFFFF',
offset: [
0,
-15
15
],
font: [
'Arial'
Expand Down
2 changes: 1 addition & 1 deletion data/styles/multi_simplelineLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const multiSimplelineLabel: Style = {
label: '{{name}}',
font: ['Arial'],
size: 12,
offset: [0, 5],
offset: [0, -5],
fontStyle: 'normal',
fontWeight: 'bold',
placement: 'point'
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_styledLabel_elementOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pointStyledLabel: Style = {
label: 'prefix: {{name}}{{title}} entity',
font: ['Arial'],
size: 12,
offset: [0, 5],
offset: [0, -5],
haloColor: '#000000',
haloWidth: 5,
opacity: 1,
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_styledLabel_literalOpenCurlyBraces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pointStyledLabel: Style = {
label: 'entity {{ xx',
font: ['Arial'],
size: 12,
offset: [0, 5],
offset: [0, -5],
haloColor: '#000000',
haloWidth: 5,
opacity: 1,
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_styledLabel_literalPlaceholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pointStyledLabel: Style = {
label: 'foo {{name}}{{prop}} entity {{bar}}',
font: ['Arial'],
size: 12,
offset: [0, 5],
offset: [0, -5],
haloColor: '#000000',
haloWidth: 5,
haloOpacity: 1,
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_styledlabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const pointStyledLabel: Style = {
label: '{{name}}',
font: ['Arial'],
size: 12,
offset: [0, 5],
offset: [0, -5],
haloColor: '#000000',
haloWidth: 5,
haloOpacity: 1,
Expand Down
4 changes: 2 additions & 2 deletions src/SldStyleParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ export class SldStyleParser implements StyleParser<string> {
const y = get(displacement, 'DisplacementY.#text');
textSymbolizer.offset = [
Number.isFinite(x) ? numberExpression(x) : 0,
Number.isFinite(y) ? numberExpression(y) : 0,
Number.isFinite(y) ? -numberExpression(y) : 0,
];
}
const rotation = get(pointPlacement, 'Rotation.#text');
Expand Down Expand Up @@ -2016,7 +2016,7 @@ export class SldStyleParser implements StyleParser<string> {
}]
}, {
[DisplacementY]: [{
'#text': textSymbolizer.offset[1].toString()
'#text': (-textSymbolizer.offset[1]).toString()
}]
}]
});
Expand Down

0 comments on commit 398ce0c

Please sign in to comment.