diff --git a/app.js b/app.js index 1d92be7..3797897 100644 --- a/app.js +++ b/app.js @@ -28,6 +28,7 @@ require([ "./modules/goToLocation.js", "esri/widgets/Measurement", + "./modules/mediaQuery.js" ], ( Conversion, @@ -50,11 +51,15 @@ require([ initLegend, initELevation, goToLocation, - Measurement + Measurement, + initMediaQuery ) => { /************************************************************ * Init scene (/w layers) and view ************************************************************/ + // const mediaQuery = window.matchMedia('(max-width: 768px)'); + // initMediaQuery.handleMediaQueryChange(mediaQuery) + // mediaQuery.addEventListener(initMediaQuery.handleMediaQueryChange); const graphicsLayer = initLayers.setupGraphicsLayer(); @@ -81,10 +86,15 @@ require([ const view = initScene.setupWebView(scene); + + /************************************** * Adding a layer group, expand **************************************/ view.when(() => { + // Media query + + // Going to specified location at runtime const locationArray = goToLocation.getLocation(); diff --git a/index.html b/index.html index f1862ad..24f1a21 100644 --- a/index.html +++ b/index.html @@ -33,7 +33,7 @@

- + diff --git a/modules/mediaQuery.js b/modules/mediaQuery.js new file mode 100644 index 0000000..5ad65db --- /dev/null +++ b/modules/mediaQuery.js @@ -0,0 +1,11 @@ +define([], () => ({ + handleMediaQueryChange: (mql) => { + const calciteActionBars = document.querySelectorAll('calcite-action'); + if (mql.matches) { + calciteActionBars.forEach(bar => { + console.log(bar) + bar.scale ="m"; + }); + } + }, +})); diff --git a/style.css b/style.css index 5934482..b845407 100644 --- a/style.css +++ b/style.css @@ -214,3 +214,21 @@ img { width: 100%; /* Ensure the widget container takes full width */ height: 100%; /* Ensure the widget container takes full height */ } + +.responsive-action-bar { + flex-wrap: wrap; +} + +/* +@media screen and (max-width: 768px) { + .responsive-action-bar .calcite-action { + scale: "s"; + } +} +*/ + + + +.calcite-action[data-action-id="layers"]) { + --calcite-action-scale: "m"; +} \ No newline at end of file