From 04c6ea8402ec9c43277849c1ee725a8969c2830c Mon Sep 17 00:00:00 2001 From: Ismail Sunni Date: Wed, 15 May 2024 12:53:55 +0700 Subject: [PATCH 1/2] Fix wrong direction of text Y axis offset. --- src/VectorEncoder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VectorEncoder.ts b/src/VectorEncoder.ts index 57df0a5..eefed95 100644 --- a/src/VectorEncoder.ts +++ b/src/VectorEncoder.ts @@ -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(); From 7f19302f5552a3901c680cac1705cd02a9ab7559 Mon Sep 17 00:00:00 2001 From: Ismail Sunni Date: Wed, 15 May 2024 13:00:09 +0700 Subject: [PATCH 2/2] Update expected value on test.. --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 78fa666..c13cbd4 100644 --- a/test.js +++ b/test.js @@ -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,