Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { IControl, MapOptions as MapOptionsType } from "!maplibre-gl";
import { Map as MapType } from "maplibre-gl";
import maplibreGl from "maplibre-gl";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove all changes of this file. All files under the ./dist/ folder are autogenerated during the build process (yarn build). No manual changes required.


maplibreGl.setRTLTextPlugin(
'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js',
(res) => {
console.log(res);
},
true // Lazy load the plugin
);


declare type EventArgArray = [string, string | Function, Function?];
declare type LayerState = {
id: string;
Expand Down
10 changes: 10 additions & 0 deletions src/components/MapLibreMap/lib/MapLibreGlWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import {
StyleImageMetadata,
} from 'maplibre-gl';
import { Map as MapType, Style } from 'maplibre-gl';
import maplibregl from 'maplibre-gl';

Copy link
Member

@cioddi cioddi Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we must move this to its own hook. Let's call it useSetRtlTextPlugin (what a beautiful name :)).
This way we can use it optionally when we actually need it.

Please take a look at the useAddProtocol hook which might have a similar implementation
https://github.com/mapcomponents/react-map-components-maplibre/blob/main/src/hooks/useAddProtocol/useAddProtocol.tsx

Make the actual RTL-plugin URL a property of the hook with the current one you have in there as default value. That way it will be easy to use and still offer a way to use a custom RTL plugin.

maplibregl.setRTLTextPlugin(
'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js',
(res) => {
console.log(res);
},
true // Lazy load the plugin
);


type WrapperEventArgArray = [string, (arg0: unknown) => void];
type EventArgArray = [
Expand Down