maplibre-preview 1.2.7 → 1.3.9
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +2 -2
- data/docs/README_RU.md +2 -2
- data/lib/maplibre-preview/version.rb +1 -1
- data/lib/maplibre-preview/views/maplibre_layout.slim +35 -14
- data/lib/maplibre-preview/views/maplibre_map.slim +71 -31
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 576fc35a947103556613fb983552a7fea7045b5109762b666ff4541dc08a3fb1
|
|
4
|
+
data.tar.gz: 91d004357c42439be1206b8d732834f5ed4b176ca88d2461c1a243a53c2a2564
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be4c9c01fa9268120f9faa29001b571774dcadc03d190c3bf619753c06a62cd76da891d89c44f9a23eb7255863ac24c98778c9a7cbb6bc7cee86705451ada748
|
|
7
|
+
data.tar.gz: a0ca0a43e7fe67801a51e730303559eb6af9718e15d145bdd14a3d77e0e22f6eed48ab355203cb6088462954ac57d47d2dcd1de121d2fa96ee76acf38b3fbc6e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.9] - 2025-11-19
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **Version info display** - removed service name, kept only version number
|
|
7
|
+
- **Version info styling** - repositioned to bottom-right corner with gray background, compact padding, subtle colors
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **Collapsible layer controls panel** - added collapse/expand button with arrow icon for layer controls panel
|
|
11
|
+
|
|
12
|
+
## [1.3.7] - 2025-10-29
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Antialias toggle control** - button to enable/disable antialias with localStorage persistence and page reload
|
|
16
|
+
- **Style-based initial view** - support for `center` and `zoom` properties from style JSON according to MapLibre Style Spec
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Default map center** - updated to `[96.63, 64.81]`
|
|
20
|
+
|
|
3
21
|
## [1.2.7] - 2025-10-20
|
|
4
22
|
|
|
5
23
|
### Fixed
|
data/README.md
CHANGED
|
@@ -118,8 +118,8 @@ This starts a complete web server with:
|
|
|
118
118
|
|
|
119
119
|
The gem uses fixed configurations for optimal compatibility:
|
|
120
120
|
|
|
121
|
-
- **Map Center**: `[
|
|
122
|
-
- **Initial Zoom**: `2`
|
|
121
|
+
- **Map Center**: `[96.63, 64.81]` (default, can be overridden by style's `center` property)
|
|
122
|
+
- **Initial Zoom**: `2` (default, can be overridden by style's `zoom` property)
|
|
123
123
|
- **Basemap**: OpenStreetMap tiles with 0.8 opacity
|
|
124
124
|
- **Library Versions**: MapLibre GL JS 5.7.3, MapLibre Contour 0.1.0, D3.js 7
|
|
125
125
|
|
data/docs/README_RU.md
CHANGED
|
@@ -118,8 +118,8 @@ MapLibrePreview::App.run!
|
|
|
118
118
|
|
|
119
119
|
Gem использует фиксированные настройки:
|
|
120
120
|
|
|
121
|
-
- **Центр карты**: `[
|
|
122
|
-
- **Начальный зум**: `2`
|
|
121
|
+
- **Центр карты**: `[96.63, 64.81]` (по умолчанию, можно переопределить свойством `center` в стиле)
|
|
122
|
+
- **Начальный зум**: `2` (по умолчанию, можно переопределить свойством `zoom` в стиле)
|
|
123
123
|
- **Базовая карта**: Тайлы OpenStreetMap с прозрачностью 0.8
|
|
124
124
|
- **Версии библиотек**: MapLibre GL JS 5.7.3, MapLibre Contour 0.1.0, D3.js 7
|
|
125
125
|
|
|
@@ -154,11 +154,36 @@ html
|
|
|
154
154
|
| }
|
|
155
155
|
| .controls a { color: #6897bb; text-decoration: none; margin-right: 15px; }
|
|
156
156
|
| .controls a:hover { text-decoration: underline; }
|
|
157
|
-
| .layer-controls {
|
|
157
|
+
| .layer-controls-wrapper {
|
|
158
158
|
| position: absolute; top: 50%; left: 10px; transform: translateY(-50%); z-index: 1000;
|
|
159
|
-
|
|
|
159
|
+
| display: flex; align-items: center; gap: 0;
|
|
160
|
+
| }
|
|
161
|
+
| .layer-controls {
|
|
162
|
+
| background: rgba(60, 63, 65, 0.95); border: 1px solid #555555; border-right: none; padding: 15px;
|
|
160
163
|
| border-radius: 4px; color: #a9b7c6; display: flex; flex-direction: column; gap: 6px;
|
|
161
|
-
| max-width: 300px; max-height: 80vh;
|
|
164
|
+
| max-width: 300px; max-height: 80vh; transition: max-width 0.2s;
|
|
165
|
+
| overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); order: 1;
|
|
166
|
+
| }
|
|
167
|
+
| .layer-controls.collapsed {
|
|
168
|
+
| max-width: 0; padding: 15px 0; border: none; opacity: 0; pointer-events: none;
|
|
169
|
+
| }
|
|
170
|
+
| .layer-controls-toggle {
|
|
171
|
+
| background: rgba(60, 63, 65, 0.95); border: 1px solid #555555;
|
|
172
|
+
| border-left: none; border-radius: 0 4px 4px 0; padding: 8px 4px;
|
|
173
|
+
| color: #a9b7c6; cursor: pointer; display: flex; align-items: center; justify-content: center;
|
|
174
|
+
| width: 18px; height: auto; min-height: 60px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); order: 2;
|
|
175
|
+
| }
|
|
176
|
+
| .layer-controls-toggle:hover {
|
|
177
|
+
| background: rgba(75, 77, 79, 0.95); color: #ffc66d; border-color: #666666;
|
|
178
|
+
| }
|
|
179
|
+
| .layer-controls-wrapper.collapsed .layer-controls-toggle {
|
|
180
|
+
| order: 0; border-left: 1px solid #555555; border-right: 1px solid #555555; border-radius: 4px;
|
|
181
|
+
| }
|
|
182
|
+
| .layer-controls-wrapper.collapsed .toggle-icon {
|
|
183
|
+
| transform: rotate(180deg);
|
|
184
|
+
| }
|
|
185
|
+
| .toggle-icon {
|
|
186
|
+
| font-size: 12px; font-weight: bold; transition: transform 0.2s;
|
|
162
187
|
| }
|
|
163
188
|
| .mode-switcher {
|
|
164
189
|
| display: flex; gap: 2px; margin-bottom: 10px; background: #3c3f41;
|
|
@@ -325,23 +350,19 @@ html
|
|
|
325
350
|
| .profile-tooltip-circle { fill: #ff0000; r: 4; }
|
|
326
351
|
| .profile-tooltip-text { text-anchor: middle; fill: #ff0000; font-size: 14px; }
|
|
327
352
|
| .version-info {
|
|
328
|
-
| position: fixed; bottom:
|
|
329
|
-
|
|
|
330
|
-
|
|
|
331
|
-
| user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
|
|
332
|
-
| }
|
|
333
|
-
| .version-info-title {
|
|
334
|
-
| color: #ffc66d; font-weight: bold;
|
|
335
|
-
| font-size: 12px;
|
|
353
|
+
| position: fixed; bottom: 0; right: 0; z-index: 1000;
|
|
354
|
+
| background: rgba(60, 63, 65, 0.85); border: none; border-radius: 4px 0 0 0;
|
|
355
|
+
| padding: 4px 8px; backdrop-filter: blur(5px);
|
|
356
|
+
| line-height: 1.2; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
|
|
336
357
|
| }
|
|
337
358
|
| .version-info-version {
|
|
338
|
-
| color: #
|
|
359
|
+
| color: #808080; font-family: 'Courier New', monospace; text-decoration: none;
|
|
339
360
|
| transition: color 0.2s ease;
|
|
340
|
-
| font-size:
|
|
361
|
+
| font-size: 11px;
|
|
341
362
|
| user-select: auto; -webkit-user-select: auto; -moz-user-select: auto; -ms-user-select: auto;
|
|
342
363
|
| }
|
|
343
364
|
| .version-info-version:hover {
|
|
344
|
-
| color: #
|
|
365
|
+
| color: #a9b7c6; text-decoration: none;
|
|
345
366
|
| }
|
|
346
367
|
body
|
|
347
368
|
.container
|
|
@@ -10,32 +10,35 @@ ruby:
|
|
|
10
10
|
.progress-fill
|
|
11
11
|
|
|
12
12
|
- if style_name || external_style_url || options[:style_url]
|
|
13
|
-
.layer-controls
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
.layer-controls-wrapper
|
|
14
|
+
.layer-controls id="layer-controls"
|
|
15
|
+
.mode-switcher
|
|
16
|
+
button.mode-button.active id="mode-filters" onclick="switchMode(this, 'filters')" Filters
|
|
17
|
+
button.mode-button id="mode-layers" onclick="switchMode(this, 'layers')" Layers
|
|
18
|
+
button.control-button onclick="toggleHoverMode()" id="hover-mode-btn" Hover Mode
|
|
19
|
+
button.control-button onclick="toggleProfileMode()" id="profile-mode-btn" style="display: none;" Elevation Profile
|
|
20
|
+
button.control-button onclick="toggleAntialias()" id="antialias-btn" Antialias
|
|
21
|
+
|
|
22
|
+
#filters-panel.control-panel.active
|
|
23
|
+
.control-panel-header
|
|
24
|
+
button.control-button onclick="toggleAllFilters()" Toggle All Filters
|
|
25
|
+
button.control-button onclick="toggleBasemap()" Show/Hide Basemap
|
|
26
|
+
.control-panel-content
|
|
27
|
+
#filter-buttons
|
|
28
|
+
|
|
29
|
+
#layers-panel.control-panel
|
|
30
|
+
.control-panel-header
|
|
31
|
+
button.control-button onclick="toggleAllLayers()" Toggle All Layers
|
|
32
|
+
button.control-button onclick="toggleBasemap()" Show/Hide Basemap
|
|
33
|
+
.control-panel-content
|
|
34
|
+
#layer-buttons
|
|
35
|
+
button.layer-controls-toggle id="layer-controls-toggle" onclick="toggleLayerControls()" title="Collapse/Expand Panel"
|
|
36
|
+
span.toggle-icon ▶
|
|
33
37
|
|
|
34
38
|
#map-container
|
|
35
39
|
#map.map-layer data-style-url="#{style_url}"
|
|
36
40
|
|
|
37
41
|
#version-info.version-info
|
|
38
|
-
span.version-info-title MapLibre Preview
|
|
39
42
|
a.version-info-version href="https://github.com/artyomb/maplibre-preview" target="_blank" v#{MapLibrePreview::VERSION}
|
|
40
43
|
|
|
41
44
|
#performance-panel.performance-overlay
|
|
@@ -76,6 +79,7 @@ javascript:
|
|
|
76
79
|
let hoverMode = 'click';
|
|
77
80
|
let layerStates = {};
|
|
78
81
|
let map = null;
|
|
82
|
+
let antialiasEnabled = localStorage.getItem('antialiasEnabled') !== 'false';
|
|
79
83
|
let styleLoaded = false, resourcesLoaded = 0, totalResources = 0;
|
|
80
84
|
let tilesLoaded = 0, tilesTotal = 0;
|
|
81
85
|
let currentStyle = null;
|
|
@@ -175,15 +179,23 @@ javascript:
|
|
|
175
179
|
}
|
|
176
180
|
};
|
|
177
181
|
|
|
178
|
-
const createMap = (container, style) =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
const createMap = (container, style) => {
|
|
183
|
+
const defaultCenter = [96.637778, 64.811389];
|
|
184
|
+
const defaultZoom = 2;
|
|
185
|
+
|
|
186
|
+
const center = Array.isArray(style?.center) && style.center.length === 2 ? style.center : defaultCenter;
|
|
187
|
+
const zoom = typeof style?.zoom === 'number' ? style.zoom : defaultZoom;
|
|
188
|
+
|
|
189
|
+
return new maplibregl.Map({
|
|
190
|
+
container,
|
|
191
|
+
style,
|
|
192
|
+
center,
|
|
193
|
+
zoom,
|
|
194
|
+
attributionControl: false,
|
|
195
|
+
validateStyle: false,
|
|
196
|
+
antialias: antialiasEnabled
|
|
197
|
+
});
|
|
198
|
+
};
|
|
187
199
|
|
|
188
200
|
const addBasemapToStyle = (originalStyle) => {
|
|
189
201
|
const modifiedStyle = JSON.parse(JSON.stringify(originalStyle));
|
|
@@ -389,7 +401,7 @@ javascript:
|
|
|
389
401
|
|
|
390
402
|
const setupPerformanceMonitoring = () => {
|
|
391
403
|
[startPerformanceMonitoring, () => requestAnimationFrame(countFrame),
|
|
392
|
-
updateHoverModeButton, updateBasemapButton].forEach(fn => fn());
|
|
404
|
+
updateHoverModeButton, updateBasemapButton, updateAntialiasButton].forEach(fn => fn());
|
|
393
405
|
};
|
|
394
406
|
|
|
395
407
|
const toggleBasemap = () => {
|
|
@@ -831,6 +843,32 @@ javascript:
|
|
|
831
843
|
requestAnimationFrame(countFrame);
|
|
832
844
|
};
|
|
833
845
|
|
|
846
|
+
const toggleAntialias = () => {
|
|
847
|
+
antialiasEnabled = !antialiasEnabled;
|
|
848
|
+
localStorage.setItem('antialiasEnabled', antialiasEnabled.toString());
|
|
849
|
+
window.location.reload();
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
const updateAntialiasButton = () => {
|
|
853
|
+
const btn = document.getElementById('antialias-btn');
|
|
854
|
+
if (!btn) return;
|
|
855
|
+
|
|
856
|
+
btn.textContent = `Antialias: ${antialiasEnabled ? 'ON' : 'OFF'}`;
|
|
857
|
+
btn.className = `control-button ${antialiasEnabled ? 'active' : 'inactive'}`;
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
let layerControlsCollapsed = false;
|
|
861
|
+
|
|
862
|
+
const toggleLayerControls = () => {
|
|
863
|
+
const wrapper = document.querySelector('.layer-controls-wrapper');
|
|
864
|
+
const controls = document.getElementById('layer-controls');
|
|
865
|
+
if (!wrapper || !controls) return;
|
|
866
|
+
|
|
867
|
+
layerControlsCollapsed = !layerControlsCollapsed;
|
|
868
|
+
controls.classList.toggle('collapsed', layerControlsCollapsed);
|
|
869
|
+
wrapper.classList.toggle('collapsed', layerControlsCollapsed);
|
|
870
|
+
};
|
|
871
|
+
|
|
834
872
|
window.switchMode = switchMode;
|
|
835
873
|
window.toggleBasemap = toggleBasemap;
|
|
836
874
|
window.toggleHoverMode = toggleHoverMode;
|
|
@@ -838,6 +876,8 @@ javascript:
|
|
|
838
876
|
window.toggleAllLayers = toggleAllLayers;
|
|
839
877
|
window.togglePerformancePanel = togglePerformancePanel;
|
|
840
878
|
window.toggleProfileMode = toggleProfileMode;
|
|
879
|
+
window.toggleAntialias = toggleAntialias;
|
|
880
|
+
window.toggleLayerControls = toggleLayerControls;
|
|
841
881
|
window.hideProfile = hideProfile;
|
|
842
882
|
|
|
843
883
|
initializeMap();
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maplibre-preview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander Ludov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|