@defra/interactive-map 0.0.52-alpha → 0.0.54-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/css/index.css +1 -1
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/context.md +30 -12
  7. package/docs/api/marker-config.md +16 -8
  8. package/docs/api/symbol-config.md +24 -9
  9. package/docs/api/symbol-registry.md +49 -14
  10. package/docs/api.md +11 -3
  11. package/docs/plugins/datasets.md +6 -10
  12. package/docs/plugins/draw.md +2 -1
  13. package/docs/plugins/map-key.md +47 -4
  14. package/package.json +1 -1
  15. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  16. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
  17. package/plugins/beta/map-styles/dist/umd/index.js +1 -1
  18. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  19. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
  20. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  21. package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
  22. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  23. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  24. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  25. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +6 -6
  26. package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
  27. package/plugins/datasets/src/adapters/maplibre/layerBuilders.js +10 -10
  28. package/plugins/datasets/src/adapters/maplibre/layerBuilders.test.js +22 -6
  29. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +9 -3
  30. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +18 -3
  31. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +3 -3
  32. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +20 -27
  33. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +16 -70
  34. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +30 -115
  35. package/plugins/datasets/src/adapters/openlayers/layerBuilders.js +11 -13
  36. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +11 -3
  37. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +48 -19
  38. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +101 -13
  39. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +27 -28
  40. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +51 -32
  41. package/plugins/datasets/src/fetch/createDynamicSource.js +2 -2
  42. package/plugins/datasets/src/initialise/DatasetsInit.jsx +2 -2
  43. package/plugins/datasets/src/initialise/defaults.js +16 -27
  44. package/plugins/datasets/src/initialise/defaults.test.js +25 -57
  45. package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -4
  46. package/plugins/datasets/src/reducers/__data__/demoDatasets.js +1 -3
  47. package/plugins/datasets/src/reducers/mappedDatasetsReducer.test.js +1 -1
  48. package/plugins/datasets/src/registry/dataset.js +23 -17
  49. package/plugins/datasets/src/registry/dataset.test.js +114 -11
  50. package/plugins/datasets/src/registry/mapboxStyleDataset.js +1 -1
  51. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +1 -1
  52. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  53. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  54. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  55. package/plugins/draw/dist/esm/index.js +1 -1
  56. package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
  57. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  58. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  59. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  60. package/plugins/draw/dist/umd/index.js +1 -1
  61. package/plugins/draw/src/DrawInit.jsx +7 -5
  62. package/plugins/draw/src/DrawInit.test.jsx +18 -2
  63. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +11 -5
  64. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -11
  65. package/plugins/draw/src/adapters/maplibre/mapboxDraw.js +12 -9
  66. package/plugins/draw/src/adapters/maplibre/mapboxDraw.test.js +18 -0
  67. package/plugins/draw/src/adapters/maplibre/pointSymbolImages.js +81 -56
  68. package/plugins/draw/src/adapters/maplibre/pointSymbolImages.test.js +149 -80
  69. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +7 -6
  70. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +22 -25
  71. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +26 -8
  72. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +58 -16
  73. package/plugins/draw/src/adapters/openlayers/core/styles.js +33 -20
  74. package/plugins/draw/src/adapters/openlayers/core/styles.test.js +47 -21
  75. package/plugins/draw/src/adapters/openlayers/olDraw.js +16 -12
  76. package/plugins/draw/src/adapters/openlayers/olDraw.test.js +27 -32
  77. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.js +44 -49
  78. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +100 -119
  79. package/plugins/draw/src/defaults.js +2 -6
  80. package/plugins/draw/src/utils/stripInternalProperties.test.js +2 -1
  81. package/plugins/draw/src/utils/symbolKeys.js +3 -4
  82. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  83. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  84. package/plugins/interact/dist/umd/index.js +1 -1
  85. package/plugins/map-key/dist/css/index.css +1 -1
  86. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  87. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -2
  88. package/plugins/map-key/dist/umd/index.js +1 -1
  89. package/plugins/map-key/src/components/Key/Key.jsx +8 -4
  90. package/plugins/map-key/src/components/Key/Key.module.scss +144 -53
  91. package/plugins/map-key/src/components/Key/KeyGroupItem.jsx +36 -3
  92. package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +44 -2
  93. package/plugins/map-key/src/components/Key/KeyItem.jsx +2 -2
  94. package/plugins/map-key/src/components/Key/KeySvg.jsx +19 -18
  95. package/plugins/map-key/src/components/Key/KeySvg.test.jsx +25 -18
  96. package/plugins/map-key/src/components/Key/KeySvgPattern.jsx +1 -2
  97. package/plugins/map-key/src/components/Key/KeySvgPattern.test.jsx +3 -1
  98. package/plugins/map-key/src/components/Key/KeySvgRamp.jsx +35 -6
  99. package/plugins/map-key/src/components/Key/KeySvgRamp.test.jsx +56 -16
  100. package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +26 -12
  101. package/plugins/map-key/src/components/Key/KeySvgSymbol.test.jsx +24 -74
  102. package/plugins/map-key/src/components/Key/MapKey.jsx +3 -1
  103. package/plugins/map-key/src/components/Key/svgProperties.js +8 -2
  104. package/plugins/map-key/src/components/Key/useRampOrientation.js +61 -0
  105. package/plugins/map-key/src/components/Key/useRampOrientation.test.jsx +155 -0
  106. package/plugins/map-key/src/index.js +34 -0
  107. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +15 -0
  108. package/plugins/map-key/src/registry/index.js +0 -2
  109. package/plugins/map-key/src/registry/index.test.js +1 -9
  110. package/plugins/map-key/src/utils/groupStyles.js +5 -2
  111. package/plugins/menu/src/registry/index.js +0 -2
  112. package/plugins/menu/src/registry/index.test.js +1 -9
  113. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  114. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  115. package/plugins/search/dist/umd/index.js +1 -1
  116. package/plugins/search/src/Search.jsx +0 -1
  117. package/plugins/search/src/components/Form/Form.jsx +3 -3
  118. package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -0
  119. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +6 -0
  120. package/plugins/search/src/defaults.js +3 -0
  121. package/plugins/search/src/events/formHandlers.js +3 -9
  122. package/plugins/search/src/events/formHandlers.test.js +6 -9
  123. package/plugins/search/src/events/inputHandlers.js +8 -2
  124. package/plugins/search/src/events/inputHandlers.test.js +20 -0
  125. package/plugins/search/src/events/suggestionHandlers.js +3 -5
  126. package/plugins/search/src/events/suggestionHandlers.test.js +5 -8
  127. package/plugins/search/src/utils/showResult.js +9 -0
  128. package/plugins/search/src/utils/showResult.test.js +16 -0
  129. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  130. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  131. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  132. package/providers/beta/openlayers/dist/umd/index.js +1 -1
  133. package/providers/beta/openlayers/src/openlayersProvider.js +102 -2
  134. package/providers/beta/openlayers/src/openlayersProvider.test.js +95 -0
  135. package/providers/beta/openlayers/src/utils/highlightFeatures.js +20 -25
  136. package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +73 -38
  137. package/providers/beta/openlayers/src/utils/patternImages.js +61 -0
  138. package/providers/beta/openlayers/src/utils/patternImages.test.js +74 -0
  139. package/providers/beta/openlayers/src/utils/symbolImages.js +103 -95
  140. package/providers/beta/openlayers/src/utils/symbolImages.test.js +136 -85
  141. package/providers/mapProvider.js +53 -1
  142. package/providers/mapProvider.test.js +6 -0
  143. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  144. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  145. package/providers/maplibre/dist/umd/index.js +1 -1
  146. package/providers/maplibre/src/maplibreProvider.js +50 -17
  147. package/providers/maplibre/src/maplibreProvider.test.js +74 -20
  148. package/providers/maplibre/src/utils/highlightFeatures.js +19 -14
  149. package/providers/maplibre/src/utils/highlightFeatures.test.js +20 -14
  150. package/providers/maplibre/src/utils/patternImages.js +46 -29
  151. package/providers/maplibre/src/utils/patternImages.test.js +52 -4
  152. package/providers/maplibre/src/utils/symbolImages.js +80 -39
  153. package/providers/maplibre/src/utils/symbolImages.test.js +157 -54
  154. package/src/App/components/Hints/Hints.module.scss +1 -1
  155. package/src/App/components/Markers/Markers.jsx +16 -25
  156. package/src/App/components/Markers/Markers.test.jsx +34 -48
  157. package/src/App/components/Markers/SymbolLabelMarker.jsx +1 -1
  158. package/src/App/components/Markers/SymbolMarker.jsx +1 -1
  159. package/src/App/components/Viewport/Viewport.jsx +6 -4
  160. package/src/App/components/Viewport/Viewport.test.jsx +18 -1
  161. package/src/App/hooks/useMapAnnouncements.js +7 -2
  162. package/src/App/hooks/useMapAnnouncements.test.js +13 -2
  163. package/src/App/hooks/useModalPanelBehaviour.js +3 -1
  164. package/src/App/initialiseApp.js +1 -1
  165. package/src/App/store/ServiceProvider.jsx +12 -3
  166. package/src/App/store/ServiceProvider.test.jsx +39 -0
  167. package/src/InteractiveMap/InteractiveMap.js +3 -3
  168. package/src/config/appConfig.js +1 -5
  169. package/src/config/mapSizeScales.js +8 -0
  170. package/src/config/symbolConfig.js +101 -25
  171. package/src/services/mapFocus.js +64 -0
  172. package/src/services/mapFocus.test.js +76 -0
  173. package/src/services/patternRegistry.js +97 -76
  174. package/src/services/patternRegistry.test.js +19 -1
  175. package/src/services/symbolComposer.js +184 -0
  176. package/src/services/symbolComposer.test.js +132 -0
  177. package/src/services/symbolRegistry.js +326 -155
  178. package/src/services/symbolRegistry.test.js +334 -32
  179. package/src/types.js +11 -5
  180. package/src/utils/detectInterfaceType.js +16 -5
  181. package/src/utils/detectInterfaceType.test.js +32 -0
  182. package/src/utils/hashString.js +23 -0
  183. package/src/utils/hashString.test.js +29 -0
  184. package/src/utils/imageDataCache.js +43 -0
  185. package/src/utils/imageDataCache.test.js +38 -0
  186. package/src/utils/pathBounds.js +330 -0
  187. package/src/utils/pathBounds.test.js +145 -0
  188. package/src/utils/patternUtils.js +0 -8
  189. package/src/utils/patternUtils.test.js +0 -25
  190. package/src/utils/recentImageSets.js +35 -0
  191. package/src/utils/recentImageSets.test.js +46 -0
  192. package/src/utils/symbolUtils.js +26 -29
  193. package/src/utils/symbolUtils.test.js +27 -41
  194. package/plugins/map-key/dist/umd/im-map-key-plugin.js.LICENSE.txt +0 -1
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.openLayersProvider=t())}(this,()=>(()=>{"use strict";var e,t,r={},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-openlayers-provider.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.openLayersProvider:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var s=f[p];if(s.getAttribute("src")==r||s.getAttribute("data-webpack")==t+i){u=s;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var l=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof f?n:f,p=Object.create(a.prototype);return u(p,"_invoke",function(r,n,o){var i,a,u,f=0,p=o||[],s=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,u=e,l.n=r,c}};function d(r,n){for(a=r,u=n,t=0;!s&&f&&!o&&t<p.length;t++){var o,i=p[t],d=l.p,v=i[2];r>3?(o=v===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,l.v=n,l.n=i[1]):d<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,a=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&d(p,v),a=p,u=v;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(l.n=-1),d(a,u)):l.n=u:l.v=u);try{if(f=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=l.n<0)?u:r.call(n,l))!==c)break}catch(t){i=e,a=1,u=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),p}var c={};function f(){}function p(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=s.prototype=f.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=s,u(d,"constructor",s),u(s,"constructor",p),p.displayName="GeneratorFunction",u(s,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).zoomAlignment;return{checkDeviceCapabilities:function(){return{isSupported:!!document.createElement("canvas").getContext,error:"Canvas is not supported in this browser"}},load:(e=a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(142).then(o.bind(o,382));case 1:return t=e.v.default,n={zoomAlignment:r,crs:"EPSG:27700"},e.a(2,{MapProvider:t,mapProviderConfig:n})}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,u,"next",e)}function u(e){c(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})}}return o.d(i,{default:()=>f}),i.default})());
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.openLayersProvider=t())}(this,()=>(()=>{"use strict";var e,t,r={},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-openlayers-provider.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.openLayersProvider:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var s=f[p];if(s.getAttribute("src")==r||s.getAttribute("data-webpack")==t+i){u=s;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var l=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof f?n:f,p=Object.create(a.prototype);return u(p,"_invoke",function(r,n,o){var i,a,u,f=0,p=o||[],s=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,u=e,l.n=r,c}};function d(r,n){for(a=r,u=n,t=0;!s&&f&&!o&&t<p.length;t++){var o,i=p[t],d=l.p,v=i[2];r>3?(o=v===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,l.v=n,l.n=i[1]):d<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,a=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&d(p,v),a=p,u=v;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(l.n=-1),d(a,u)):l.n=u:l.v=u);try{if(f=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=l.n<0)?u:r.call(n,l))!==c)break}catch(t){i=e,a=1,u=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),p}var c={};function f(){}function p(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=s.prototype=f.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=s,u(d,"constructor",s),u(s,"constructor",p),p.displayName="GeneratorFunction",u(s,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).zoomAlignment;return{checkDeviceCapabilities:function(){return{isSupported:!!document.createElement("canvas").getContext,error:"Canvas is not supported in this browser"}},load:(e=a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(142).then(o.bind(o,256));case 1:return t=e.v.default,n={zoomAlignment:r,crs:"EPSG:27700"},e.a(2,{MapProvider:t,mapProviderConfig:n})}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,u,"next",e)}function u(e){c(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})}}return o.d(i,{default:()=>f}),i.default})());
@@ -14,6 +14,9 @@ import { attachMapEvents } from './mapEvents.js'
14
14
  import { attachAppEvents, createMapStyleLayer } from './appEvents.js'
15
15
  import { getAreaDimensions, getCardinalMove, getExtentFromGeoJSON, getPaddedExtent, isGeometryObscured } from './utils/spatial.js'
16
16
  import { updateHighlightedFeatures } from './utils/highlightFeatures.js'
17
+ import { SymbolImageCache } from './utils/symbolImages.js'
18
+ import { PatternImageCache } from './utils/patternImages.js'
19
+ import { buildFilterEvaluator } from './utils/filterEvaluator.js'
17
20
  import { queryFeatures, getVisibleFeatures } from './utils/queryFeatures.js'
18
21
  import { collectTileFragments } from './utils/vtTileFragments.js'
19
22
  import { setupHoverCursor } from './utils/hoverCursor.js'
@@ -51,6 +54,9 @@ export default class OpenLayersProvider extends MapProvider {
51
54
  supportedShortcuts,
52
55
  supportsMapSizes: true
53
56
  }
57
+ // This map's rasterised symbol images (see addSymbolsToMap)
58
+ this.symbolImages = new SymbolImageCache()
59
+ this.patternImages = new PatternImageCache()
54
60
  Object.assign(this, mapProviderConfig)
55
61
  }
56
62
 
@@ -340,7 +346,7 @@ export default class OpenLayersProvider extends MapProvider {
340
346
  */
341
347
  updateHighlightedFeatures (selectedFeatures, activeFeatures, stylesMap) {
342
348
  this._lastHighlightArgs = { selectedFeatures, activeFeatures, stylesMap }
343
- return updateHighlightedFeatures(this.map, selectedFeatures, activeFeatures, stylesMap)
349
+ return updateHighlightedFeatures(this.map, selectedFeatures, activeFeatures, stylesMap, this.symbolImages)
344
350
  }
345
351
 
346
352
  /**
@@ -354,7 +360,101 @@ export default class OpenLayersProvider extends MapProvider {
354
360
  return
355
361
  }
356
362
  const { selectedFeatures, activeFeatures, stylesMap } = this._lastHighlightArgs
357
- updateHighlightedFeatures(this.map, selectedFeatures, activeFeatures, stylesMap)
363
+ updateHighlightedFeatures(this.map, selectedFeatures, activeFeatures, stylesMap, this.symbolImages)
364
+ }
365
+
366
+ // ==========================
367
+ // Symbol images
368
+ // ==========================
369
+
370
+ /**
371
+ * Rasterise and register symbol images (normal, active and selected) for the given symbol
372
+ * configs, at the map's pixel ratio unless one is given.
373
+ *
374
+ * @param {Object[]} symbolConfigs - an array of symbol configs
375
+ * @param {Object} mapStyle - Current map style config
376
+ * @param {Object} symbolRegistry
377
+ * @param {number} [pixelRatio] - defaults to the map's current pixel ratio
378
+ * @returns {Promise<void>}
379
+ */
380
+ async addSymbolsToMap (symbolConfigs, mapStyle, symbolRegistry, pixelRatio = this.map.getPixelRatio() || 1) {
381
+ return this.symbolImages.registerSymbols(symbolConfigs, mapStyle, symbolRegistry, pixelRatio)
382
+ }
383
+
384
+ /**
385
+ * A registered symbol image, as a canvas — for an ol/style/Icon `img`.
386
+ *
387
+ * @param {string} imageId
388
+ * @returns {HTMLCanvasElement|undefined}
389
+ */
390
+ getSymbolImage (imageId) {
391
+ return this.symbolImages.getImage(imageId)
392
+ }
393
+
394
+ /**
395
+ * A registered symbol image's data URI — for a flat style's `icon-src`. Only normal images
396
+ * have one.
397
+ *
398
+ * @param {string} imageId
399
+ * @returns {string|undefined}
400
+ */
401
+ getSymbolDataUri (imageId) {
402
+ return this.symbolImages.getDataUri(imageId)
403
+ }
404
+
405
+ /**
406
+ * Rasterises each pattern's image and caches it as a crisp CanvasPattern fill. Fills already
407
+ * cached are reused.
408
+ *
409
+ * @param {Object[]} patternConfigs - an array of pattern configs
410
+ * @param {string} mapStyleId
411
+ * @param {Object} patternRegistry
412
+ * @param {number} [pixelRatio] - defaults to the map's current pixel ratio
413
+ * @returns {Promise<void>}
414
+ */
415
+ async addPatternsToMap (patternConfigs, mapStyleId, patternRegistry, pixelRatio = this.map.getPixelRatio() || 1) {
416
+ return this.patternImages.registerPatterns(patternConfigs, mapStyleId, patternRegistry, pixelRatio)
417
+ }
418
+
419
+ /**
420
+ * A registered pattern's fill — an ol/style/Fill for a style's `fill`.
421
+ *
422
+ * @param {string} imageId
423
+ * @returns {import('ol/style/Fill.js').default|undefined}
424
+ */
425
+ getPatternFill (imageId) {
426
+ return this.patternImages.getFill(imageId)
427
+ }
428
+
429
+ /**
430
+ * Compiles a dataset filter (a MapLibre-style filter expression) into a per-feature predicate,
431
+ * matching how queryFeatures applies a layer's filter.
432
+ *
433
+ * @param {Array|null} filter
434
+ * @returns {((feature: import('ol/Feature.js').default) => boolean)|null}
435
+ */
436
+ buildFilterEvaluator (filter) {
437
+ return buildFilterEvaluator(filter)
438
+ }
439
+
440
+ /**
441
+ * The imageId of a registered symbol's active (keyboard cursor) variant.
442
+ *
443
+ * @param {string} normalImageId
444
+ * @returns {string|null}
445
+ */
446
+ getActiveSymbolImageId (normalImageId) {
447
+ return this.symbolImages.getActiveImageId(normalImageId)
448
+ }
449
+
450
+ /**
451
+ * The imageId of a registered symbol's selected variant.
452
+ *
453
+ * @param {string} normalImageId
454
+ * @returns {string|null}
455
+ */
456
+ getSelectedSymbolImageId (normalImageId) {
457
+ return this.symbolImages.getSelectedImageId(normalImageId)
358
458
  }
359
459
 
360
460
  // ==========================
@@ -1,5 +1,8 @@
1
1
  // Mock-prefixed variables are allowed in jest.mock factories by babel-plugin-jest-hoist
2
2
  import OpenLayersProvider from './openlayersProvider.js'
3
+ import { updateHighlightedFeatures } from './utils/highlightFeatures.js'
4
+ import { SymbolImageCache } from './utils/symbolImages.js'
5
+ import { PatternImageCache } from './utils/patternImages.js'
3
6
  import { attachMapEvents } from './mapEvents.js'
4
7
  import { attachAppEvents, createMapStyleLayer } from './appEvents.js'
5
8
  import { getExtentFromGeoJSON, isGeometryObscured } from './utils/spatial.js'
@@ -61,6 +64,7 @@ jest.mock('./appEvents.js', () => ({
61
64
  createMapStyleLayer: jest.fn(async () => ({ layer: mockVectorTileLayer, source: mockSource })),
62
65
  attachAppEvents: jest.fn(() => ({ remove: mockAppEventHandlesRemove }))
63
66
  }))
67
+ jest.mock('./utils/highlightFeatures.js', () => ({ __esModule: true, updateHighlightedFeatures: jest.fn() }))
64
68
  jest.mock('./utils/spatial.js', () => ({
65
69
  __esModule: true,
66
70
  getAreaDimensions: jest.fn(() => '1 mile by 2 miles'),
@@ -422,4 +426,95 @@ describe('OpenLayersProvider', () => {
422
426
  expect(isGeometryObscured).toHaveBeenCalledWith(geojson, panelRect, mockMapInstance)
423
427
  })
424
428
  })
429
+
430
+ describe('pattern images', () => {
431
+ const patternRegistry = { id: 'app-pattern-registry' }
432
+
433
+ it('gives each provider (each map) its own pattern cache', () => {
434
+ const { provider: first } = makeProvider()
435
+ const { provider: second } = makeProvider()
436
+ expect(first.patternImages).toBeInstanceOf(PatternImageCache)
437
+ expect(first.patternImages).not.toBe(second.patternImages)
438
+ })
439
+
440
+ it('addPatternsToMap registers at the map\'s pixel ratio unless given one, and getPatternFill reads its cache', async () => {
441
+ const { provider } = makeProvider()
442
+ provider.map = { getPixelRatio: () => 2 }
443
+ const register = jest.spyOn(provider.patternImages, 'registerPatterns').mockResolvedValue()
444
+ const configs = [{ fillPattern: 'dot' }]
445
+
446
+ await provider.addPatternsToMap(configs, 'outdoor', patternRegistry)
447
+ expect(register).toHaveBeenLastCalledWith(configs, 'outdoor', patternRegistry, 2)
448
+ await provider.addPatternsToMap(configs, 'outdoor', patternRegistry, 3)
449
+ expect(register).toHaveBeenLastCalledWith(configs, 'outdoor', patternRegistry, 3)
450
+ provider.map = { getPixelRatio: () => 0 }
451
+ await provider.addPatternsToMap(configs, 'outdoor', patternRegistry)
452
+ expect(register).toHaveBeenLastCalledWith(configs, 'outdoor', patternRegistry, 1)
453
+
454
+ jest.spyOn(provider.patternImages, 'getFill').mockReturnValue('fill')
455
+ expect(provider.getPatternFill('pattern-id')).toBe('fill')
456
+ })
457
+ })
458
+
459
+ describe('symbol images', () => {
460
+ const symbolRegistry = { id: 'app-symbol-registry' }
461
+
462
+ it('gives each provider (each map) its own symbol image cache', () => {
463
+ const { provider: first } = makeProvider()
464
+ const { provider: second } = makeProvider()
465
+ expect(first.symbolImages).toBeInstanceOf(SymbolImageCache)
466
+ expect(first.symbolImages).not.toBe(second.symbolImages)
467
+ })
468
+
469
+ it('addSymbolsToMap registers at the map\'s pixel ratio unless given one', async () => {
470
+ const { provider } = makeProvider()
471
+ provider.map = { getPixelRatio: () => 2 }
472
+ const register = jest.spyOn(provider.symbolImages, 'registerSymbols').mockResolvedValue()
473
+ const configs = [{ symbol: 'pin' }]
474
+
475
+ await provider.addSymbolsToMap(configs, { id: 'outdoor' }, symbolRegistry)
476
+ expect(register).toHaveBeenLastCalledWith(configs, { id: 'outdoor' }, symbolRegistry, 2)
477
+
478
+ await provider.addSymbolsToMap(configs, { id: 'outdoor' }, symbolRegistry, 3)
479
+ expect(register).toHaveBeenLastCalledWith(configs, { id: 'outdoor' }, symbolRegistry, 3)
480
+
481
+ provider.map = { getPixelRatio: () => 0 }
482
+ await provider.addSymbolsToMap(configs, { id: 'outdoor' }, symbolRegistry)
483
+ expect(register).toHaveBeenLastCalledWith(configs, { id: 'outdoor' }, symbolRegistry, 1)
484
+ })
485
+
486
+ it('looks up registered images, data URIs and active/selected variants in its own cache', () => {
487
+ const { provider } = makeProvider()
488
+ const cache = provider.symbolImages
489
+ jest.spyOn(cache, 'getImage').mockReturnValue('canvas')
490
+ jest.spyOn(cache, 'getDataUri').mockReturnValue('data:uri')
491
+ jest.spyOn(cache, 'getActiveImageId').mockReturnValue('active-id')
492
+ jest.spyOn(cache, 'getSelectedImageId').mockReturnValue('selected-id')
493
+
494
+ expect(provider.getSymbolImage('img')).toBe('canvas')
495
+ expect(provider.getSymbolDataUri('img')).toBe('data:uri')
496
+ expect(provider.getActiveSymbolImageId('img')).toBe('active-id')
497
+ expect(provider.getSelectedSymbolImageId('img')).toBe('selected-id')
498
+ expect(cache.getImage).toHaveBeenCalledWith('img')
499
+ })
500
+
501
+ it('compiles a dataset filter into a per-feature predicate', () => {
502
+ const { provider } = makeProvider()
503
+ const matches = provider.buildFilterEvaluator(['==', ['get', 'kind'], 'field'])
504
+ expect(matches({ getProperties: () => ({ kind: 'field' }), getId: () => 1, getGeometry: () => null })).toBe(true)
505
+ expect(matches({ getProperties: () => ({ kind: 'hedge' }), getId: () => 2, getGeometry: () => null })).toBe(false)
506
+ expect(provider.buildFilterEvaluator(null)).toBeNull()
507
+ })
508
+
509
+ it('highlights with its own symbol image cache, including when re-applying', () => {
510
+ const { provider } = makeProvider()
511
+ provider.map = { id: 'map' }
512
+ updateHighlightedFeatures.mockClear()
513
+ provider.updateHighlightedFeatures(['selected'], ['active'], { styles: true })
514
+ expect(updateHighlightedFeatures).toHaveBeenLastCalledWith(provider.map, ['selected'], ['active'], { styles: true }, provider.symbolImages)
515
+ provider.reapplyHighlights()
516
+ expect(updateHighlightedFeatures).toHaveBeenCalledTimes(2)
517
+ expect(updateHighlightedFeatures).toHaveBeenLastCalledWith(provider.map, ['selected'], ['active'], { styles: true }, provider.symbolImages)
518
+ })
519
+ })
425
520
  })
@@ -7,9 +7,7 @@ import Stroke from 'ol/style/Stroke.js'
7
7
  import Fill from 'ol/style/Fill.js'
8
8
  import Icon from 'ol/style/Icon.js'
9
9
  import { collectTileFragments } from './vtTileFragments.js'
10
- import { getCachedSymbolImage, getActiveSymbolImageId, getSelectedSymbolImageId, SYMBOL_RASTER_PIXEL_RATIO } from './symbolImages.js'
11
- import { symbolRegistry } from '../../../../../src/services/symbolRegistry.js'
12
- import { getSymbolAnchor } from '../../../../../src/utils/symbolUtils.js'
10
+ import { hasSymbol } from '../../../../../src/utils/symbolUtils.js'
13
11
 
14
12
  const CRS = 'EPSG:27700'
15
13
  const geoJsonFormat = new GeoJSON({ dataProjection: CRS, featureProjection: CRS })
@@ -42,8 +40,6 @@ const buildHighlightStyles = (styleEntry, isActive) => {
42
40
  return styles
43
41
  }
44
42
 
45
- const hasSymbolStyle = (properties) => !!(properties?.symbol || properties?.symbolSvgContent)
46
-
47
43
  const toStyleArray = (style) => {
48
44
  if (!style) {
49
45
  return []
@@ -52,23 +48,22 @@ const toStyleArray = (style) => {
52
48
  }
53
49
 
54
50
  // A drawn point renders as a real symbol icon, not Stroke/Fill, so its selected/active ring is
55
- // the active/selected variant of that same icon instead. Returns null (not []) for a
56
- // non-symbol feature so the caller falls through to buildHighlightStyles.
57
- const buildSymbolHighlightStyle = (properties, isActive) => {
58
- if (!hasSymbolStyle(properties)) {
51
+ // the active/selected variant of that same icon instead — with the anchor and pixel ratio draw
52
+ // resolved it at. Returns null (not []) for a non-symbol feature so the caller falls through to
53
+ // buildHighlightStyles.
54
+ const buildSymbolHighlightStyle = (properties, isActive, symbolImages) => {
55
+ if (!hasSymbol(properties)) {
59
56
  return null
60
57
  }
61
58
  const imageId = isActive ? properties.symbolActiveImageId : properties.symbolSelectedImageId
62
- const canvas = imageId && getCachedSymbolImage(imageId)
63
- if (!canvas) {
59
+ const canvas = imageId && symbolImages?.getImage(imageId)
60
+ if (!canvas || !properties.symbolImageAnchor) {
64
61
  return null
65
62
  }
66
- const symbolDef = symbolRegistry.getSymbolDef(properties)
67
- const anchor = getSymbolAnchor(properties, symbolDef)
68
63
  // The cached canvas is rasterised at symbolPixelRatio for crispness — ol/style/Icon draws
69
64
  // it at native size, so the inverse scale keeps the displayed size correct.
70
65
  const scale = 1 / (properties.symbolPixelRatio || 1)
71
- return [new Style({ image: new Icon({ img: canvas, anchor, scale }), zIndex: HIGHLIGHT_Z })]
66
+ return [new Style({ image: new Icon({ img: canvas, anchor: properties.symbolImageAnchor, scale }), zIndex: HIGHLIGHT_Z })]
72
67
  }
73
68
 
74
69
  // ---------------------------------------------------------------------------
@@ -184,27 +179,27 @@ const getLiveProperties = (map, layerId, featureId) => {
184
179
 
185
180
  // A dataset symbol point (unlike a drawn one) has no active/selected id of its own — every
186
181
  // feature in the layer shares one base imageId, so the variant is resolved from that instead.
187
- const buildDatasetSymbolHighlightStyle = (map, layerId, isActive) => {
182
+ const buildDatasetSymbolHighlightStyle = (map, layerId, isActive, symbolImages) => {
188
183
  const symbolMeta = findVectorLayer(map, layerId)?.get('symbolMeta')
189
- if (!symbolMeta) {
184
+ if (!symbolMeta || !symbolImages) {
190
185
  return null
191
186
  }
192
- const targetId = isActive ? getActiveSymbolImageId(symbolMeta.imageId) : getSelectedSymbolImageId(symbolMeta.imageId)
193
- const canvas = targetId && getCachedSymbolImage(targetId)
187
+ const targetId = isActive ? symbolImages.getActiveImageId(symbolMeta.imageId) : symbolImages.getSelectedImageId(symbolMeta.imageId)
188
+ const canvas = targetId && symbolImages.getImage(targetId)
194
189
  if (!canvas) {
195
190
  return null
196
191
  }
197
- return [new Style({ image: new Icon({ img: canvas, anchor: symbolMeta.anchor, scale: 1 / SYMBOL_RASTER_PIXEL_RATIO }), zIndex: HIGHLIGHT_Z })]
192
+ return [new Style({ image: new Icon({ img: canvas, anchor: symbolMeta.anchor, scale: 1 / symbolMeta.pixelRatio }), zIndex: HIGHLIGHT_Z })]
198
193
  }
199
194
 
200
- const addVectorHighlights = (map, source, features, isActive, stylesMap) => {
195
+ const addVectorHighlights = (map, source, features, isActive, stylesMap, symbolImages) => {
201
196
  for (const { layerId, featureId, geometry } of features ?? []) {
202
197
  if (!geometry) {
203
198
  continue
204
199
  }
205
200
  const liveProperties = getLiveProperties(map, layerId, featureId)
206
- const styles = buildSymbolHighlightStyle(liveProperties, isActive) ??
207
- buildDatasetSymbolHighlightStyle(map, layerId, isActive) ??
201
+ const styles = buildSymbolHighlightStyle(liveProperties, isActive, symbolImages) ??
202
+ buildDatasetSymbolHighlightStyle(map, layerId, isActive, symbolImages) ??
208
203
  buildHighlightStyles(stylesMap?.[layerId], isActive)
209
204
  if (styles.length) {
210
205
  const olFeature = new Feature({ geometry: geoJsonFormat.readGeometry(geometry) })
@@ -279,7 +274,7 @@ const computeBounds = (geometries) => {
279
274
  * - VectorLayers (draw etc.): overlay Feature at zIndex 1001.
280
275
  * Returns EPSG:27700 bounds [minX, minY, maxX, maxY] for selected features, or null.
281
276
  */
282
- export const updateHighlightedFeatures = (map, selectedFeatures, activeFeatures, stylesMap) => {
277
+ export const updateHighlightedFeatures = (map, selectedFeatures, activeFeatures, stylesMap, symbolImages) => {
283
278
  if (!map) {
284
279
  return null
285
280
  }
@@ -310,8 +305,8 @@ export const updateHighlightedFeatures = (map, selectedFeatures, activeFeatures,
310
305
  const vecActive = (activeFeatures ?? []).filter(f => vectorLayerIds.has(f.layerId))
311
306
 
312
307
  // VT features are handled by style-wrap; only add vector features to overlay
313
- addVectorHighlights(map, hlSource, vecActive, true, stylesMap)
314
- addVectorHighlights(map, hlSource, vecSelected, false, stylesMap)
308
+ addVectorHighlights(map, hlSource, vecActive, true, stylesMap, symbolImages)
309
+ addVectorHighlights(map, hlSource, vecSelected, false, stylesMap, symbolImages)
315
310
 
316
311
  // Bounds from all tile fragments of selected features
317
312
  const allGeoms = (selectedFeatures ?? []).flatMap(feat => resolveGeometries(map, feat))