From 6554c528898f6d62f08cdbd861cbe2c4938ed082 Mon Sep 17 00:00:00 2001 From: William French Date: Mon, 15 Jul 2024 12:52:37 -0700 Subject: [PATCH 1/5] fix: Delete samples/local-context* Removes demos for Local Context, which has been discontinued (demos only result in an error). --- samples/local-context-basic/index.njk | 9 ----- samples/local-context-basic/index.ts | 39 ------------------- .../local-context-basic.json | 16 -------- samples/local-context-basic/style.scss | 12 ------ 4 files changed, 76 deletions(-) delete mode 100644 samples/local-context-basic/index.njk delete mode 100644 samples/local-context-basic/index.ts delete mode 100644 samples/local-context-basic/local-context-basic.json delete mode 100644 samples/local-context-basic/style.scss diff --git a/samples/local-context-basic/index.njk b/samples/local-context-basic/index.njk deleted file mode 100644 index 88051866e4..0000000000 --- a/samples/local-context-basic/index.njk +++ /dev/null @@ -1,9 +0,0 @@ - - -{% extends '../../src/_includes/layout.njk'%} {% block html %} -
-{% endblock %} diff --git a/samples/local-context-basic/index.ts b/samples/local-context-basic/index.ts deleted file mode 100644 index e442ec6a25..0000000000 --- a/samples/local-context-basic/index.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_js_local_context_basic] -let map: google.maps.Map; - -function initMap() { - // [START maps_js_local_context_basic_instantiation] - const localContextMapView = new google.maps.localContext.LocalContextMapView({ - element: document.getElementById("map"), - placeTypePreferences: [ - { type: "restaurant" }, - { type: "tourist_attraction" }, - ], - maxPlaceCount: 12, - }); - // [END maps_js_local_context_basic_instantiation] - - map = localContextMapView.map!; - - // [START maps_js_local_context_basic_set_options] - map.setOptions({ - center: { lat: 51.507307, lng: -0.08114 }, - zoom: 14, - }); - // [END maps_js_local_context_basic_set_options] -} - -declare global { - interface Window { - initMap: () => void; - } -} -window.initMap = initMap; -// [END maps_js_local_context_basic] -export {}; diff --git a/samples/local-context-basic/local-context-basic.json b/samples/local-context-basic/local-context-basic.json deleted file mode 100644 index 6f0c0f53a9..0000000000 --- a/samples/local-context-basic/local-context-basic.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Local Context Basic", - "callback": "initMap", - "libraries": [ - "localContext" - ], - "version": "beta", - "tag": "js_local_context_basic", - "name": "js-local-context-basic", - "pagination": { - "data": "mode", - "size": 1, - "alias": "mode" - }, - "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" -} diff --git a/samples/local-context-basic/style.scss b/samples/local-context-basic/style.scss deleted file mode 100644 index ac1526490f..0000000000 --- a/samples/local-context-basic/style.scss +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order - -/* [START maps_js_local_context_basic] */ -@include meta.load-css("../../shared/scss/default.scss"); - -/* [END maps_js_local_context_basic] */ From b5faa315b07580981136f5668a9238252c634014 Mon Sep 17 00:00:00 2001 From: William French Date: Mon, 15 Jul 2024 12:55:07 -0700 Subject: [PATCH 2/5] Delete samples/local-context-events directory --- samples/local-context-events/index.njk | 9 -- samples/local-context-events/index.ts | 153 ------------------ .../local-context-events.json | 16 -- samples/local-context-events/style.scss | 20 --- 4 files changed, 198 deletions(-) delete mode 100644 samples/local-context-events/index.njk delete mode 100644 samples/local-context-events/index.ts delete mode 100644 samples/local-context-events/local-context-events.json delete mode 100644 samples/local-context-events/style.scss diff --git a/samples/local-context-events/index.njk b/samples/local-context-events/index.njk deleted file mode 100644 index 88051866e4..0000000000 --- a/samples/local-context-events/index.njk +++ /dev/null @@ -1,9 +0,0 @@ - - -{% extends '../../src/_includes/layout.njk'%} {% block html %} -
-{% endblock %} diff --git a/samples/local-context-events/index.ts b/samples/local-context-events/index.ts deleted file mode 100644 index 33d04d2c61..0000000000 --- a/samples/local-context-events/index.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_js_local_context_events] -let map: google.maps.Map; - -let infoWindow; -let infoStorage; - -const districts = { - a: { - label: "1", - location: { - lat: -1.283975, - lng: 36.818797, - }, - name: "Central", - description: - "The Central Business District is a hub of economic activity during the day and a destination for great food at night.", - }, - b: { - label: "2", - location: { - lat: -1.270955, - lng: 36.810857, - }, - name: "Westlands", - description: - "With many high-end restaurants and a vibrant nightlife, Westlands attracts young professionals and their families. ", - }, - c: { - label: "3", - location: { - lat: -1.311868, - lng: 36.838624, - }, - name: "South", - description: - "Known for high-rise apartment buildings, South B and South C are in high demand.", - }, -}; - -function initMap() { - const localContextMapView = new google.maps.localContext.LocalContextMapView({ - element: document.getElementById("map"), - placeTypePreferences: [ - { type: "restaurant" }, - { type: "tourist_attraction" }, - ], - maxPlaceCount: 12, - }); - - map = localContextMapView.map!; - - map.setOptions({ - center: districts["a"].location, - zoom: 13, - }); - - // Add 3 custom markers that open InfoWindows on click - for (const key in districts) { - const district = districts[key]; - const marker = new google.maps.Marker({ - label: district.label, - position: district.location, - map: map, - zIndex: 30, - }); - - // [START maps_js_local_context_events_marker_click] - marker.addListener("click", () => { - // Close any open details or existing InfoWindows - localContextMapView.hidePlaceDetailsView(); - - if (infoWindow) { - infoWindow.close(); - } - - // Create and open a new InfoWindow - createInfoWindow(district, marker); - - // Define origin as the selected marker position - localContextMapView.directionsOptions = { - origin: district.location, - }; - }); - // [END maps_js_local_context_events_marker_click] - } - - // Set the LocalContextMapView event handlers. - // [START maps_js_local_context_events_placedetailsviewshowstart] - localContextMapView.addListener("placedetailsviewshowstart", () => { - if (infoWindow) { - infoWindow.close(); - } - }); - // [END maps_js_local_context_events_placedetailsviewshowstart] - - // [START maps_js_local_context_events_placedetailsviewhidestart] - localContextMapView.addListener("placedetailsviewhidestart", () => { - if (infoStorage) { - createInfoWindow(infoStorage.district, infoStorage.marker); - } - }); - // [END maps_js_local_context_events_placedetailsviewhidestart] -} - -// Creates an infoWindow and also stores information associated with the -// InfoWindow so the InfoWindow can be restored after it has been closed -// by non-user-initiated events. -function createInfoWindow(district, marker) { - // Build the content of the InfoWindow - const contentDiv = document.createElement("div"); - const nameDiv = document.createElement("div"); - const descriptionDiv = document.createTextNode(district.description); - - contentDiv.classList.add("infowindow-content"); - nameDiv.classList.add("title"); - nameDiv.textContent = district.name; - descriptionDiv.textContent = district.description; - contentDiv.appendChild(nameDiv); - contentDiv.appendChild(descriptionDiv); - - // Create and open a new InfoWindow - infoWindow = new google.maps.InfoWindow(); - infoWindow.setContent(contentDiv); - infoWindow.open(map, marker); - - // Store key properties of the InfoWindow for future restoration - infoStorage = { - district: district, - marker: marker, - }; - - // Clear content storage if infoWindow is closed by the user - infoWindow.addListener("closeclick", () => { - if (infoStorage) { - infoStorage = null; - } - }); -} - -declare global { - interface Window { - initMap: () => void; - } -} -window.initMap = initMap; -// [END maps_js_local_context_events] -export {}; diff --git a/samples/local-context-events/local-context-events.json b/samples/local-context-events/local-context-events.json deleted file mode 100644 index 42b7a6f4b0..0000000000 --- a/samples/local-context-events/local-context-events.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Local Context Events", - "callback": "initMap", - "libraries": [ - "localContext" - ], - "version": "beta", - "tag": "js_local_context_events", - "name": "js-local-context-events", - "pagination": { - "data": "mode", - "size": 1, - "alias": "mode" - }, - "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" -} diff --git a/samples/local-context-events/style.scss b/samples/local-context-events/style.scss deleted file mode 100644 index 68675e34d7..0000000000 --- a/samples/local-context-events/style.scss +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order - -/* [START maps_js_local_context_events] */ -@include meta.load-css("../../shared/scss/default.scss"); - -.infowindow-content { - width: 300px; - } - - .title { - font-size: x-large; - font-weight: bold; - } -/* [END maps_js_local_context_events] */ From eb21312838d9322f67ac29134495919d034f229d Mon Sep 17 00:00:00 2001 From: William French Date: Mon, 15 Jul 2024 12:55:21 -0700 Subject: [PATCH 3/5] Delete samples/local-context-home directory --- samples/local-context-home/index.njk | 10 - samples/local-context-home/index.ts | 276 ------------------ .../local-context-home.json | 17 -- samples/local-context-home/style.scss | 19 -- 4 files changed, 322 deletions(-) delete mode 100644 samples/local-context-home/index.njk delete mode 100644 samples/local-context-home/index.ts delete mode 100644 samples/local-context-home/local-context-home.json delete mode 100644 samples/local-context-home/style.scss diff --git a/samples/local-context-home/index.njk b/samples/local-context-home/index.njk deleted file mode 100644 index e7ea239801..0000000000 --- a/samples/local-context-home/index.njk +++ /dev/null @@ -1,10 +0,0 @@ - - -{% extends '../../src/_includes/layout.njk'%} {% block html %} - -
-{% endblock %} diff --git a/samples/local-context-home/index.ts b/samples/local-context-home/index.ts deleted file mode 100644 index 73d44a9296..0000000000 --- a/samples/local-context-home/index.ts +++ /dev/null @@ -1,276 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_js_local_context_home] -let map: google.maps.Map; -let localContextMapView; - -const styles: google.maps.MapTypeStyle[] = [ - { - elementType: "geometry", - stylers: [ - { - color: "#f5f5f5", - }, - ], - }, - { - elementType: "labels", - stylers: [ - { - visibility: "off", - }, - ], - }, - { - elementType: "labels.icon", - stylers: [ - { - visibility: "off", - }, - ], - }, - { - elementType: "labels.text.fill", - stylers: [ - { - color: "#616161", - }, - ], - }, - { - elementType: "labels.text.stroke", - stylers: [ - { - color: "#f5f5f5", - }, - ], - }, - { - featureType: "administrative.land_parcel", - stylers: [ - { - visibility: "off", - }, - ], - }, - { - featureType: "administrative.land_parcel", - elementType: "labels.text.fill", - stylers: [ - { - color: "#bdbdbd", - }, - ], - }, - { - featureType: "administrative.neighborhood", - stylers: [ - { - visibility: "off", - }, - ], - }, - { - featureType: "poi", - elementType: "geometry", - stylers: [ - { - color: "#eeeeee", - }, - ], - }, - { - featureType: "poi", - elementType: "labels.text.fill", - stylers: [ - { - color: "#757575", - }, - ], - }, - { - featureType: "poi.park", - elementType: "geometry", - stylers: [ - { - color: "#e5e5e5", - }, - ], - }, - { - featureType: "poi.park", - elementType: "labels.text.fill", - stylers: [ - { - color: "#9e9e9e", - }, - ], - }, - { - featureType: "road", - elementType: "geometry", - stylers: [ - { - color: "#ffffff", - }, - ], - }, - { - featureType: "road.arterial", - elementType: "labels.text.fill", - stylers: [ - { - color: "#757575", - }, - ], - }, - { - featureType: "road.highway", - elementType: "geometry", - stylers: [ - { - color: "#dadada", - }, - ], - }, - { - featureType: "road.highway", - elementType: "labels.text.fill", - stylers: [ - { - color: "#616161", - }, - ], - }, - { - featureType: "road.local", - elementType: "labels.text.fill", - stylers: [ - { - color: "#9e9e9e", - }, - ], - }, - { - featureType: "transit.line", - elementType: "geometry", - stylers: [ - { - color: "#e5e5e5", - }, - ], - }, - { - featureType: "transit.station", - elementType: "geometry", - stylers: [ - { - color: "#eeeeee", - }, - ], - }, - { - featureType: "water", - elementType: "geometry", - stylers: [ - { - color: "#c9c9c9", - }, - ], - }, - { - featureType: "water", - elementType: "labels.text.fill", - stylers: [ - { - color: "#9e9e9e", - }, - ], - }, -]; - -function initMap() { - localContextMapView = new google.maps.localContext.LocalContextMapView({ - element: document.getElementById("map"), - // [START maps_js_local_context_home_preferences] - placeTypePreferences: [ - { type: "bakery", weight: 1 }, - { type: "bank", weight: 1 }, - { type: "cafe", weight: 2 }, - { type: "department_store", weight: 1 }, - { type: "drugstore", weight: 1 }, - { type: "park", weight: 3 }, - { type: "restaurant", weight: 2 }, - { type: "primary_school", weight: 3 }, - { type: "secondary_school", weight: 3 }, - { type: "supermarket", weight: 2 }, - ], - // [END maps_js_local_context_home_preferences] - maxPlaceCount: 24, - }); - - map = localContextMapView.map!; - - map.setOptions({ - center: { lat: 51.507307, lng: -0.08114 }, - zoom: 14, - styles, - }); - - // [START maps_js_local_context_home_autocomplete] - // Build and add the Autocomplete search bar - const input = document.getElementById("input")! as HTMLInputElement; - const options = { - types: ["address"], - componentRestrictions: { - country: "us", - }, - fields: ["address_components", "geometry", "name"], - }; - const autocomplete = new google.maps.places.Autocomplete(input, options); - // [END maps_js_local_context_home_autocomplete] - - autocomplete.addListener("place_changed", () => { - const place = autocomplete.getPlace(); - - if (!place || !place.geometry) { - // User entered the name of a Place that was not suggested and - // pressed the Enter key, or the Place Details request failed. - window.alert("No address available for that input."); - return; - } - - // Recenter the map to the selected address - map.setOptions({ - center: place.geometry!.location, - zoom: 14, - }); - // Update the localContext directionsOptions origin - localContextMapView.directionsOptions = { - origin: place.geometry!.location, - }; - - new google.maps.Marker({ - position: place.geometry!.location, - map: map, - icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAAbUlEQVR4Ae3LoQ2AMAAF0TMYPJoV2IApGIJtmIMtmIAVqutraj6IiqZpmyYoCO/08R7bXbOOHSF2Ohr0HCh00EPdwImiTgYqRgxKMowUTFiUyTKRMeNQIcdMYsGjSp6FyIoaWkmoUuLxEPzDh1xIaLFFuTyHMgAAAABJRU5ErkJggg==", - zIndex: 30, - }); - - // update the results with new places - localContextMapView.search(); - }); -} - -declare global { - interface Window { - initMap: () => void - } -} -window.initMap = initMap; -// [END maps_js_local_context_home] -export {}; diff --git a/samples/local-context-home/local-context-home.json b/samples/local-context-home/local-context-home.json deleted file mode 100644 index ae95982f7a..0000000000 --- a/samples/local-context-home/local-context-home.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "title": "Local Context Home", - "callback": "initMap", - "libraries": [ - "localContext", - "places" - ], - "version": "beta", - "tag": "js_local_context_home", - "name": "js-local-context-home", - "pagination": { - "data": "mode", - "size": 1, - "alias": "mode" - }, - "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" -} diff --git a/samples/local-context-home/style.scss b/samples/local-context-home/style.scss deleted file mode 100644 index fc026600b4..0000000000 --- a/samples/local-context-home/style.scss +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order - -/* [START maps_js_local_context_home] */ -@include meta.load-css("../../shared/scss/default.scss"); - -input { - height: 30px; - margin: 12px 0px; - padding: 10px; - width: 300px; - } - -/* [END maps_js_local_context_home] */ From fec32d79f8ac22b676735e536fb5939cd262e480 Mon Sep 17 00:00:00 2001 From: William French Date: Mon, 15 Jul 2024 12:55:38 -0700 Subject: [PATCH 4/5] Delete samples/local-context-restrictions directory --- samples/local-context-restrictions/index.njk | 9 ---- samples/local-context-restrictions/index.ts | 47 ------------------- .../local-context-restrictions.json | 16 ------- samples/local-context-restrictions/style.scss | 12 ----- 4 files changed, 84 deletions(-) delete mode 100644 samples/local-context-restrictions/index.njk delete mode 100644 samples/local-context-restrictions/index.ts delete mode 100644 samples/local-context-restrictions/local-context-restrictions.json delete mode 100644 samples/local-context-restrictions/style.scss diff --git a/samples/local-context-restrictions/index.njk b/samples/local-context-restrictions/index.njk deleted file mode 100644 index 88051866e4..0000000000 --- a/samples/local-context-restrictions/index.njk +++ /dev/null @@ -1,9 +0,0 @@ - - -{% extends '../../src/_includes/layout.njk'%} {% block html %} -
-{% endblock %} diff --git a/samples/local-context-restrictions/index.ts b/samples/local-context-restrictions/index.ts deleted file mode 100644 index d6b1890eb8..0000000000 --- a/samples/local-context-restrictions/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_js_local_context_restrictions] -let map: google.maps.Map; - -function initMap() { - const center = { lat: 37.4219998, lng: -122.0840572 }; - // [START maps_js_local_context_restrictions_location] - const bigBounds = { - north: 37.432, - south: 37.412, - west: -122.094, - east: -122.074, - }; - // [START maps_js_local_context_restrictions_instantiation] - const localContextMapView = new google.maps.localContext.LocalContextMapView({ - element: document.getElementById("map"), - placeTypePreferences: [{ type: "restaurant" }], - maxPlaceCount: 12, - locationRestriction: bigBounds, - directionsOptions: { origin: center }, - }); - // [END maps_js_local_context_restrictions_instantiation] - // [END maps_js_local_context_restrictions_location] - - map = localContextMapView.map!; - - new google.maps.Marker({ position: center, map: map }); - - map.setOptions({ - center: center, - zoom: 16, - }); -} - -declare global { - interface Window { - initMap: () => void; - } -} -window.initMap = initMap; -// [END maps_js_local_context_restrictions] -export {}; diff --git a/samples/local-context-restrictions/local-context-restrictions.json b/samples/local-context-restrictions/local-context-restrictions.json deleted file mode 100644 index 84315bf755..0000000000 --- a/samples/local-context-restrictions/local-context-restrictions.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Local Context Restrictions", - "callback": "initMap", - "libraries": [ - "localContext" - ], - "version": "beta", - "tag": "js_local_context_restrictions", - "name": "js-local-context-restrictions", - "pagination": { - "data": "mode", - "size": 1, - "alias": "mode" - }, - "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" -} diff --git a/samples/local-context-restrictions/style.scss b/samples/local-context-restrictions/style.scss deleted file mode 100644 index 469d4dc355..0000000000 --- a/samples/local-context-restrictions/style.scss +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order - -/* [START maps_js_local_context_restrictions] */ -@include meta.load-css("../../shared/scss/default.scss"); - -/* [END maps_js_local_context_restrictions] */ From 045107c0279828d79dbd1d4ebf33259704ff67a3 Mon Sep 17 00:00:00 2001 From: William French Date: Mon, 15 Jul 2024 12:55:57 -0700 Subject: [PATCH 5/5] Delete samples/local-context-styles directory --- samples/local-context-styles/index.njk | 9 -- samples/local-context-styles/index.ts | 127 ------------------ .../local-context-styles.json | 16 --- samples/local-context-styles/style.scss | 12 -- 4 files changed, 164 deletions(-) delete mode 100644 samples/local-context-styles/index.njk delete mode 100644 samples/local-context-styles/index.ts delete mode 100644 samples/local-context-styles/local-context-styles.json delete mode 100644 samples/local-context-styles/style.scss diff --git a/samples/local-context-styles/index.njk b/samples/local-context-styles/index.njk deleted file mode 100644 index 88051866e4..0000000000 --- a/samples/local-context-styles/index.njk +++ /dev/null @@ -1,9 +0,0 @@ - - -{% extends '../../src/_includes/layout.njk'%} {% block html %} -
-{% endblock %} diff --git a/samples/local-context-styles/index.ts b/samples/local-context-styles/index.ts deleted file mode 100644 index a4f571badb..0000000000 --- a/samples/local-context-styles/index.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_js_local_context_styles] -let map: google.maps.Map; -const center = { lat: 21.27869, lng: -157.826347 }; - -const styles: google.maps.MapTypeStyle[] = [ - { elementType: "geometry", stylers: [{ color: "#efe6be" }] }, - { elementType: "labels.icon", stylers: [{ visibility: "off" }] }, - { - elementType: "labels.text.fill", - stylers: [{ color: "#f5f5f5" }, { weight: 1.5 }], - }, - { - elementType: "labels.text.stroke", - stylers: [{ color: "#9e9e9e" }, { weight: 1.5 }], - }, - { - featureType: "administrative.land_parcel", - stylers: [{ visibility: "off" }], - }, - { - featureType: "administrative.land_parcel", - elementType: "labels.text.fill", - stylers: [{ color: "#bdbdbd" }], - }, - { - featureType: "administrative.neighborhood", - stylers: [{ visibility: "off" }], - }, - { - featureType: "poi", - elementType: "geometry", - stylers: [{ color: "#c44135" }], - }, - { - featureType: "poi.park", - elementType: "geometry", - stylers: [{ color: "#328829" }], - }, - { - featureType: "poi.sports_complex", - elementType: "geometry", - stylers: [{ color: "#2ca37b" }], - }, - { - featureType: "road", - elementType: "geometry", - stylers: [{ color: "#e4b083" }], - }, - { - featureType: "road", - elementType: "labels", - stylers: [{ visibility: "off" }], - }, - { - featureType: "water", - elementType: "geometry", - stylers: [{ color: "#32cbb1" }], - }, - { - featureType: "water", - elementType: "labels.text", - stylers: [{ visibility: "off" }], - }, - { - featureType: "water", - elementType: "labels.text.fill", - stylers: [{ color: "#9e9e9e" }], - }, -]; - -function initMap() { - const localContextMapView = new google.maps.localContext.LocalContextMapView({ - element: document.getElementById("map"), - placeTypePreferences: [ - { type: "bakery", weight: 1 }, - { type: "park", weight: 2 }, - { type: "restaurant", weight: 3 }, - { type: "shopping_mall", weight: 1 }, - { type: "tourist_attraction", weight: 3 }, - ], - maxPlaceCount: 18, - directionsOptions: { origin: center }, - }); - - map = localContextMapView.map!; - - // Trigger hidePlaceDetailsView() with a click event handler on the inner map. - map.addListener("click", () => { - localContextMapView.hidePlaceDetailsView(); - }); - - // [START maps_js_local_context_styles_merge] - // Merge map styles. - const mergedStyles = map.get("styles").concat(styles); - - map.setOptions({ - center: center, - zoom: 14, - styles: mergedStyles, - }); - // [END maps_js_local_context_styles_merge] - - // [START maps_js_local_context_styles_marker] - // Add a marker at the center point - new google.maps.Marker({ - position: center, - map: map, - icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAdUlEQVR4AWMYOWAU/AfhYWMBCxA3A/FlIN4MxN7I6gjg80DcD8QC+CzIxqIxH6aOSHwfYQmmBZexuQymjgTcj8uCz1gUHybDgvO4LFiMRXE4GRb8x2UBDxCXQ8PxPdSrLNSxAD+g3ALCeNQCKoHhZcHAg1EAAM3cyWj3TGxhAAAAAElFTkSuQmCC", - zIndex: 30, - }); - // [END maps_js_local_context_styles_marker] -} - -declare global { - interface Window { - initMap: () => void; - } -} -window.initMap = initMap; -// [END maps_js_local_context_styles] -export {}; diff --git a/samples/local-context-styles/local-context-styles.json b/samples/local-context-styles/local-context-styles.json deleted file mode 100644 index 356ec2fd31..0000000000 --- a/samples/local-context-styles/local-context-styles.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Local Context Styles", - "callback": "initMap", - "libraries": [ - "localContext" - ], - "version": "beta", - "tag": "js_local_context_styles", - "name": "js-local-context-styles", - "pagination": { - "data": "mode", - "size": 1, - "alias": "mode" - }, - "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" -} diff --git a/samples/local-context-styles/style.scss b/samples/local-context-styles/style.scss deleted file mode 100644 index 188d9b0ccd..0000000000 --- a/samples/local-context-styles/style.scss +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order - -/* [START maps_js_local_context_styles] */ -@include meta.load-css("../../shared/scss/default.scss"); - -/* [END maps_js_local_context_styles] */