Skip to content

Commit

Permalink
Merge pull request #32 from geoblocks/fix-text-label-y-offset
Browse files Browse the repository at this point in the history
Fix wrong direction of text Y axis offset.
  • Loading branch information
ismailsunni authored May 15, 2024
2 parents a6f4faa + 7f19302 commit 0b1a940
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/VectorEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ export default class VectorEncoder {
label: textStyle.getText(),
fontFamily: textStyle.getFont() ? textStyle.getFont() : 'sans-serif',
labelXOffset: textStyle.getOffsetX(),
labelYOffset: textStyle.getOffsetY(),
// OL and MFP behaves differently on the Y offset
labelYOffset: -textStyle.getOffsetY(),
labelAlign: 'cm',
} as MFPSymbolizerText;
const fillStyle = textStyle.getFill();
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const styleFn = (feature) => {
text: new Text({
text: feature.get('name'),
font: '12px sans-serif',
offsetY: 12,
offsetY: -12,
}),
image: new Circle({
fill,
Expand Down

0 comments on commit 0b1a940

Please sign in to comment.