From 56e44a7cd3ac6a69f549d3c39939c004c1840ac6 Mon Sep 17 00:00:00 2001 From: Ouyang Leyan Date: Sun, 20 Oct 2024 23:33:53 +0200 Subject: [PATCH 1/2] manage text-keep-upright:false --- src/stylefunction.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stylefunction.js b/src/stylefunction.js index f1d0a548..95f5ddca 100644 --- a/src/stylefunction.js +++ b/src/stylefunction.js @@ -1402,6 +1402,16 @@ export function stylefunction( ), ), ); + const keepUpright = getValue( + layer, + 'layout', + 'text-keep-upright', + zoom, + f, + functionCache, + featureState, + ); + text.setKeepUpright(keepUpright); const textAnchor = getValue( layer, 'layout', From c04889c3073f10d8c332282637340148f825e0f3 Mon Sep 17 00:00:00 2001 From: Ouyang Leyan Date: Thu, 24 Oct 2024 23:47:42 +0200 Subject: [PATCH 2/2] Check for existence of setKeepUpright --- src/stylefunction.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/stylefunction.js b/src/stylefunction.js index 95f5ddca..cc1c564e 100644 --- a/src/stylefunction.js +++ b/src/stylefunction.js @@ -1402,16 +1402,18 @@ export function stylefunction( ), ), ); - const keepUpright = getValue( - layer, - 'layout', - 'text-keep-upright', - zoom, - f, - functionCache, - featureState, - ); - text.setKeepUpright(keepUpright); + if (typeof text.setKeepUpright === 'function') { + const keepUpright = getValue( + layer, + 'layout', + 'text-keep-upright', + zoom, + f, + functionCache, + featureState, + ); + text.setKeepUpright(keepUpright); + } const textAnchor = getValue( layer, 'layout',