From 8355ee4c1e6d884f1fe495fde4a12ad5bdcd0785 Mon Sep 17 00:00:00 2001 From: evlist Date: Mon, 6 Feb 2023 18:52:14 +0100 Subject: [PATCH] Differentiating between web and non web platforms. --- src/components/finder/Finder.module.css | 7 +++++++ src/components/finder/Finder.tsx | 8 +++++++- src/components/map/Map.tsx | 26 +++++++++++++++++-------- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/components/finder/Finder.module.css b/src/components/finder/Finder.module.css index 5f3ebc6..7052f0a 100644 --- a/src/components/finder/Finder.module.css +++ b/src/components/finder/Finder.module.css @@ -5,6 +5,13 @@ margin-left: calc(100% - 230px) !important; z-index: 1; } +.control_web { + opacity: 1; + position: fixed !important; + top: 0px; + margin-left: calc(100% - 190px) !important; + z-index: 1; +} .ol_popup { position: absolute; background-color: white; diff --git a/src/components/finder/Finder.tsx b/src/components/finder/Finder.tsx index 6d59251..ddd0075 100644 --- a/src/components/finder/Finder.tsx +++ b/src/components/finder/Finder.tsx @@ -112,7 +112,13 @@ const Finder: Component = (props) => { return ( <> -
+
{ setOpen(true); diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 3deb25f..924e72d 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -10,6 +10,7 @@ import Attribution from 'ol/control/Attribution'; import Rotate from 'ol/control/Rotate'; import ScaleLine from 'ol/control/ScaleLine'; import Control from 'ol/control/Control'; +import Zoom from 'ol/control/Zoom'; import { fromLonLat, toLonLat } from 'ol/proj'; import DragRotate from 'ol/interaction/DragRotate'; @@ -43,6 +44,7 @@ import { AndroidFullScreen } from '@awesome-cordova-plugins/android-full-screen' import Account from '../account'; import { Overlays } from '../overlays/Overlays'; import Finder, { findLocation } from '../finder'; +import { ZoomIn } from '@suid/icons-material'; const [getState, setState] = createSignal({ lon: 0, @@ -252,6 +254,16 @@ const Map: Component = () => { // vectorTile: clusterableVectorTileSource.getProjection(), // }); + let controls = [ + new Attribution({ collapsible: true }), + new Rotate(), + new ScaleLine({ bar: true }), + ]; + + if (window.Capacitor.platform === 'web') { + controls.push(new Zoom()); + } + const olMap = new OlMap({ view: new View({ center: fromLonLat([+getState().lon, +getState().lat]), @@ -260,11 +272,7 @@ const Map: Component = () => { }), layers: [tileLayer, vectorLayer], target: target, - controls: new Collection([ - new Attribution({ collapsible: true }), - new Rotate(), - new ScaleLine({ bar: true }), - ]), + controls: new Collection(controls), moveTolerance: 10, interactions: new Collection([ new DragRotate(), @@ -291,9 +299,11 @@ const Map: Component = () => { - - - + + + + +