Skip to content

Commit 4fcf606

Browse files
Merge pull request #2737 from NCEAS/feature-2698-leo-section-maps
Support fetching Zoom Preset info from LEO News Network
2 parents c985515 + 498a9bc commit 4fcf606

File tree

19 files changed

+732
-197
lines changed

19 files changed

+732
-197
lines changed

eslint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ const metacatuiConfig = {
8282
google: "readonly",
8383
},
8484
},
85+
// Tells eslint-plugin-jsdoc to allow namepaths like MapConfig#CameraPosition
86+
settings: {
87+
jsdoc: {
88+
mode: "jsdoc",
89+
},
90+
},
8591
// Override rules that are not compatible with MetacatUI
8692
rules: {
8793
...airbnbRulesOverrides,

src/css/map-view.css

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ represents 1 unit of the given distance measurement. */
501501

502502
.toolbar__content-header {
503503
color: var(--portal-col-primary-7);
504-
font-size: 1.5rem;
504+
font-size: 1.25rem;
505505
font-weight: 700;
506-
line-height: 2rem;
506+
line-height: 1.5rem;
507507
margin: 1rem 1.5rem;
508508
}
509509
}
@@ -698,9 +698,9 @@ represents 1 unit of the given distance measurement. */
698698

699699
.search-input {
700700
padding-bottom: 1rem;
701-
background-color: var(--portal-col-neutral-00, var(--map-col-bkg));
702701

703702
.search-input__field {
703+
background-color: var(--portal-col-neutral-00, var(--map-col-bkg));
704704
position: relative;
705705
display: flex;
706706
justify-content: flex-end;
@@ -2008,8 +2008,12 @@ other class: .ui-slider-range */
20082008
width: 100%;
20092009

20102010
.viewfinder__search {
2011-
border-bottom: 1px solid
2012-
var(--portal-col-neutral-2, var(--map-col-bkg-lightest__deprecate));
2011+
background-color: var(
2012+
--portal-col-primary-1,
2013+
var(--map-col-bkg__deprecate)
2014+
);
2015+
border: 1px solid var(--portal-col-primary-2);
2016+
padding-top: 1.5rem;
20132017
}
20142018

20152019
.viewfinder__zoom-presets {
@@ -2070,7 +2074,7 @@ other class: .ui-slider-range */
20702074
.viewfinder-zoom-presets {
20712075
display: flex;
20722076
flex-direction: column;
2073-
padding: 0.5rem 1.5rem 1rem 1.5rem;
2077+
padding: 0.1rem 1.5rem 1rem 1.5rem;
20742078
row-gap: 0.5rem;
20752079

20762080
.viewfinder-zoom-preset__preset {
@@ -2080,7 +2084,7 @@ other class: .ui-slider-range */
20802084
cursor: pointer;
20812085
display: flex;
20822086
flex-direction: column;
2083-
padding: 1rem 1.5rem 1rem 2.5rem;
2087+
padding: 1.1rem 1.1rem 1rem 1.4rem;
20842088
row-gap: 0.5rem;
20852089

20862090
&:hover {
@@ -2151,6 +2155,14 @@ other class: .ui-slider-range */
21512155
}
21522156
}
21532157

2158+
.viewfinder-zoom-preset__image {
2159+
float: left;
2160+
margin: 0.3rem 0.5rem 0 0;
2161+
border-radius: var(--map-border-radius-big);
2162+
max-width: 90px;
2163+
max-height: 90px;
2164+
}
2165+
21542166
.viewfinder-zoom-preset.viewfinder-zoom-preset--active
21552167
.viewfinder-zoom-preset__preset {
21562168
background-color: var(--portal-col-primary-6, #15324e);
@@ -2255,6 +2267,27 @@ other class: .ui-slider-range */
22552267
animation: fadeIn 0.3s ease-in-out;
22562268
}
22572269
}
2270+
2271+
/* modifier to make the toggle text title-like */
2272+
.expansion-panel--title {
2273+
box-shadow: none;
2274+
2275+
.expansion-panel__toggle {
2276+
font-size: 1.3rem;
2277+
}
2278+
2279+
.expansion-panel__title {
2280+
font-weight: 600;
2281+
color: var(--portal-col-primary-7, var(--map-col-highlight__deprecate));
2282+
}
2283+
.expansion-panel__icon {
2284+
fill: var(--portal-col-primary-7, var(--map-col-highlight__deprecate));
2285+
color: var(--portal-col-primary-7, var(--map-col-highlight__deprecate));
2286+
}
2287+
.expansion-panel__toggle {
2288+
padding: 0.5rem 1.5rem;
2289+
}
2290+
}
22582291
/** END - Expansion panel View. */
22592292

22602293
/*****************************************************************************************
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"use strict";
2+
3+
define([
4+
"backbone",
5+
"models/maps/viewfinder/ZoomPresetCategory",
6+
"models/maps/Map",
7+
"collections/maps/viewfinder/ZoomPresets",
8+
], (Backbone, ZoomPresetCategory, MapModel, ZoomPresets) => {
9+
/**
10+
* @classdesc ZoomPresetCategories is a collection of ZoomPresetCategory
11+
* models. Each category groups a ZoomPresets collection used by the
12+
* Viewfinder UI.
13+
* @classcategory Collections/Maps
14+
* @class ZoomPresetCategories
15+
* @augments Backbone.Collection
16+
* @since 0.0.0
17+
* @class
18+
*/
19+
const ZoomPresetCategories = Backbone.Collection.extend(
20+
/** @lends ZoomPresetCategories.prototype */ {
21+
/** @inheritdoc */
22+
model: ZoomPresetCategory,
23+
24+
/**
25+
* Parse raw category configs into attributes for ZoomPresetCategory
26+
* models. Ensures the Map model is available to each category.
27+
* @param {MapConfig#ZoomPresetCategory[]} resp The raw array of category
28+
* configs.
29+
* @param {object} options Options passed to the collection constructor.
30+
* @param {MapModel} [options.mapModel] The Map model for these presets.
31+
* @returns {object[]} The parsed attributes for each model.
32+
*/
33+
parse(resp, options = {}) {
34+
const { mapModel } = options;
35+
if (!Array.isArray(resp)) return [];
36+
return resp.map((attrs) => ({ ...attrs, mapModel }));
37+
},
38+
39+
/**
40+
* Set the parent Map model on each ZoomPresetCategory in this collection.
41+
* @param {MapModel} mapModel The Map model that contains these
42+
* categories.
43+
*/
44+
setMapModel(mapModel) {
45+
this.each((categoryModel) => categoryModel.setMapModel(mapModel));
46+
},
47+
48+
/**
49+
* Get a single flattened ZoomPresets collection from all categories.
50+
* @returns {ZoomPresets} A ZoomPresets collection constructed from the
51+
* combined models of each category's ZoomPresets.
52+
*/
53+
getZoomPresetsFlat() {
54+
const models = this.map(
55+
(cat) => cat.get("zoomPresets")?.models || [],
56+
).flat();
57+
return new ZoomPresets(models);
58+
},
59+
60+
/**
61+
* Get an array of ZoomPresets, one per ZoomPresetCategory.
62+
* @returns {ZoomPresets[]} A list of ZoomPresets collections.
63+
*/
64+
getZoomPresets() {
65+
return this.map((cat) => cat.get("zoomPresets"));
66+
},
67+
},
68+
);
69+
70+
return ZoomPresetCategories;
71+
});

0 commit comments

Comments
 (0)