Skip to content

Commit

Permalink
update mapbox gl draw example (#5393)
Browse files Browse the repository at this point in the history
* update mapbox-gl-draw example description to match the example provided

* update mapbox-gl-draw version in example since it exposes the canvas class which is necessary as it was renamed in maplibre-gl-js
  • Loading branch information
andrewharvey authored Jan 23, 2025
1 parent 40e3bcb commit c151bf3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/examples/mapbox-gl-draw.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Draw polygon with maplibre-gl-draw</title>
<meta property="og:description" content="Use jsr:@birkskyum/maplibre-gl-draw to draw a polygon and Turf.js to calculate its area in square meters." />
<title>Draw polygon with mapbox-gl-draw</title>
<meta property="og:description" content="Use mapbox-gl-draw to draw a polygon and Turf.js to calculate its area in square meters." />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='../../dist/maplibre-gl.css' />
Expand Down Expand Up @@ -31,10 +31,10 @@
font-size: 13px;
}
</style>
<script src="https://www.unpkg.com/@mapbox/mapbox-gl-draw@1.4.3/dist/mapbox-gl-draw.js"></script>
<script src="https://www.unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js"></script>
<link
rel="stylesheet"
href="https://www.unpkg.com/@mapbox/mapbox-gl-draw@1.4.3/dist/mapbox-gl-draw.css"
href="https://www.unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"
/>
<div id="map"></div>
<div class="calculation-box">
Expand All @@ -47,9 +47,11 @@

import * as turf from 'https://esm.sh/@turf/turf@7.1.0';

MapboxDraw.constants.classes.CANVAS = 'maplibregl-canvas';
MapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';
MapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';
MapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';
MapboxDraw.constants.classes.ATTRIBUTION = 'maplibregl-ctrl-attrib';

const map = new maplibregl.Map({
container: 'map', // container id
Expand Down

0 comments on commit c151bf3

Please sign in to comment.