From c96758ea89a9f0bbc69713e23587ec4215512c51 Mon Sep 17 00:00:00 2001 From: mdastous-bentley Date: Wed, 6 Apr 2022 08:00:15 -0400 Subject: [PATCH 1/6] Use iTwinUI-react components to get consistent styling. --- .../src/ui/widget/AttachLayerPopupButton.tsx | 4 +- .../src/ui/widget/BasemapPanel.scss | 27 ++---- .../map-layers/src/ui/widget/BasemapPanel.tsx | 8 +- .../src/ui/widget/MapLayerDroppable.tsx | 5 +- .../src/ui/widget/MapLayerManager.scss | 93 ++++++------------- .../src/ui/widget/MapLayerSettingsMenu.tsx | 4 +- .../widget/MapLayerSettingsPopupButton.scss | 5 +- .../ui/widget/MapLayerSettingsPopupButton.tsx | 5 +- .../src/ui/widget/SubLayersPopupButton.tsx | 5 +- .../ui/widget/TransparencyPopupButton.scss | 23 ++--- .../src/ui/widget/TransparencyPopupButton.tsx | 6 +- 11 files changed, 71 insertions(+), 114 deletions(-) diff --git a/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx b/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx index 7962c9e0dc36..83c495b299c8 100644 --- a/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx +++ b/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx @@ -436,10 +436,10 @@ export function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) { if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) { button = ( - + ); } else { const determineStyleType = () => { diff --git a/extensions/map-layers/src/ui/widget/BasemapPanel.scss b/extensions/map-layers/src/ui/widget/BasemapPanel.scss index d9bd61212e81..fd183d772fd8 100644 --- a/extensions/map-layers/src/ui/widget/BasemapPanel.scss +++ b/extensions/map-layers/src/ui/widget/BasemapPanel.scss @@ -5,7 +5,7 @@ @import "~@itwin/core-react/lib/cjs/core-react/index"; $divider-color: $buic-background-toolbutton-stroke; -$hovered-icon-color: $buic-foreground-primary-tone; +$hovered-icon-color: $buic-foreground-primary; .map-manager-basemap { display: flex; @@ -24,17 +24,6 @@ $hovered-icon-color: $buic-foreground-primary-tone; width: 100%; margin-top: 5px; - .map-transparency-popup-button { - background-color: transparent; - margin-left: 5px; - width: 40px; - border: none; - color: $buic-foreground-body; - - &:hover { - color: $hovered-icon-color; - } - } } .map-manager-base-label { @@ -51,13 +40,16 @@ $hovered-icon-color: $buic-foreground-primary-tone; overflow: hidden; } - button.map-manager-base-item-visibility { - border: none; - margin-right: 4px; - background-color: transparent; - color: $buic-foreground-body; + .map-manager-base-item-select { + width: 100%; // makes the Select control fill empty space on the right + } + + .map-manager-base-item-visibility { + border: none; + height: 25px; &:hover { + background-color: transparent; color: $hovered-icon-color; } } @@ -69,6 +61,7 @@ $hovered-icon-color: $buic-foreground-primary-tone; color: $buic-foreground-body; &:hover { + background-color: transparent; color: $hovered-icon-color; } } diff --git a/extensions/map-layers/src/ui/widget/BasemapPanel.tsx b/extensions/map-layers/src/ui/widget/BasemapPanel.tsx index cf5d4bc024c2..d5abdff21919 100644 --- a/extensions/map-layers/src/ui/widget/BasemapPanel.tsx +++ b/extensions/map-layers/src/ui/widget/BasemapPanel.tsx @@ -10,7 +10,7 @@ import { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, Map import { DisplayStyleState } from "@itwin/core-frontend"; import { WebFontIcon } from "@itwin/core-react"; import { ColorPickerDialog, ColorSwatch } from "@itwin/imodel-components-react"; -import { Select, SelectOption } from "@itwin/itwinui-react"; +import { Button, Select, SelectOption } from "@itwin/itwinui-react"; import * as React from "react"; import { MapLayersUI } from "../../mapLayers"; import "./BasemapPanel.scss"; @@ -152,11 +152,11 @@ export function BasemapPanel() { return ( <>
- + {baseLayerLabel} - { baseIsColor && diff --git a/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx b/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx index d413c137b405..963dabe800a8 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx +++ b/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx @@ -54,8 +54,9 @@ export function MapLayerDroppable(props: MapLayerDroppableProps) {
- + {activeLayer.name}
{activeLayer.subLayers && activeLayer.subLayers.length > 1 && diff --git a/extensions/map-layers/src/ui/widget/MapLayerManager.scss b/extensions/map-layers/src/ui/widget/MapLayerManager.scss index 6e830d19194f..1e352065f702 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerManager.scss +++ b/extensions/map-layers/src/ui/widget/MapLayerManager.scss @@ -6,24 +6,8 @@ @import "~@itwin/itwinui-css/scss/style/typography"; $divider-color: $buic-background-toolbutton-stroke; -$hovered-icon-color: $buic-foreground-primary-tone; - -button.map-manager-item-visibility { - background-color: transparent; - border: none; - color: $buic-foreground-body; - background-color: transparent; - - &:hover { - color: $hovered-icon-color; - } - - &:focus { - outline: none; - box-shadow: $uicore-button-focus-boxshadow; - } -} - +$hovered-icon-color: $buic-foreground-primary; +$default-icon-height: 20px; .map-manager-layer-host { margin: 0 6px; height: 100%; @@ -66,9 +50,8 @@ button.map-manager-item-visibility { padding-right: 5px; } - .map-manager-toggle { - height: 24px; - } + // .map-manager-toggle { + // } } .map-manager-container { @@ -98,21 +81,14 @@ button.map-manager-item-visibility { padding-left: 10px; .map-manager-attach-layer-button { - background-color: transparent; margin-left: auto; width: 40px; - border: none; - color: $buic-foreground-body; + height: $default-icon-height; margin-right: 2px; - &:hover { + background-color: transparent; color: $hovered-icon-color; } - - &:focus { - box-shadow: $uicore-button-focus-boxshadow; - outline: none; - } } } @@ -308,20 +284,15 @@ button.map-manager-item-visibility { margin-right: 6px; } - button.map-manager-item-visibility { + .map-manager-item-visibility { border: none; margin: 0 2px; - background-color: $buic-background-1; - color: $buic-foreground-body; - + height: $default-icon-height; &:hover { + background-color: transparent; color: $hovered-icon-color; } - &:focus { - outline: none; - box-shadow: $uicore-button-focus-boxshadow; - } } button.map-manager-item-requireAuth { @@ -339,39 +310,33 @@ button.map-manager-item-visibility { box-shadow: $uicore-button-focus-boxshadow; } } -} - -.map-layer-settings { - border: none; - background-color: $buic-background-1; - color: $buic-foreground-body; - margin-left: 2px; - - &:hover { - color: $hovered-icon-color; - } + .map-layer-settings { + border: none; + background-color: transparent; + color: $buic-foreground-body; + height: $default-icon-height; + margin-left: 2px; - &:focus { - box-shadow: $uicore-button-focus-boxshadow; - outline: none; + &:hover { + background-color: transparent; + color: $hovered-icon-color; + } } -} -.map-manager-item-sub-layer-button { - border: none; - background-color: $buic-background-1; - color: $buic-foreground-body; - - &:hover { - color: $hovered-icon-color; - } + .map-manager-item-sub-layer-button { + border: none; + height: $default-icon-height; + background-color: transparent; + color: $buic-foreground-body; - &:focus { - box-shadow: $uicore-button-focus-boxshadow; - outline: none; + &:hover { + background-color: transparent; + color: $hovered-icon-color; + } } } + .map-manager-item-sub-layer-container { @include uicore-z-index(dialog-popup); } diff --git a/extensions/map-layers/src/ui/widget/MapLayerSettingsMenu.tsx b/extensions/map-layers/src/ui/widget/MapLayerSettingsMenu.tsx index a47c78414fdb..0ba1b501cb10 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerSettingsMenu.tsx +++ b/extensions/map-layers/src/ui/widget/MapLayerSettingsMenu.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import { ScreenViewport } from "@itwin/core-frontend"; import { ContextMenu, ContextMenuItem } from "@itwin/core-react"; -import { Slider } from "@itwin/itwinui-react"; +import { Button, Slider } from "@itwin/itwinui-react"; import "./MapLayerManager.scss"; import { StyleMapLayerSettings } from "../Interfaces"; import { MapLayersUI } from "../../mapLayers"; @@ -81,7 +81,7 @@ export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, ac return ( <> - + {labelZoomToLayer} {labelDetach} diff --git a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss index 19b087d1f4e3..80d39d7230ef 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss +++ b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ @import "~@itwin/core-react/lib/cjs/core-react/index"; -$hovered-icon-color: $buic-foreground-primary-tone; +$hovered-icon-color: $buic-foreground-primary; .maplayers-settings-popup-panel { z-index: 14000; @@ -13,6 +13,7 @@ $hovered-icon-color: $buic-foreground-primary-tone; width: 340px; } +.map-manager-header-buttons-group { .maplayers-settings-popup-button { color: $buic-foreground-body; font-size: 20px; @@ -23,9 +24,11 @@ $hovered-icon-color: $buic-foreground-primary-tone; &:hover { color: $hovered-icon-color; + background-color: transparent; } &:focus { outline: none; } +} } \ No newline at end of file diff --git a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.tsx b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.tsx index 9edf11ee3d46..b4dbfa65c4d6 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.tsx +++ b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.tsx @@ -10,6 +10,7 @@ import { MapManagerSettings } from "./MapManagerSettings"; import "./MapLayerSettingsPopupButton.scss"; import { MapLayersUI } from "../../mapLayers"; +import { Button } from "@itwin/itwinui-react"; /** @alpha */ // eslint-disable-next-line @typescript-eslint/naming-convention @@ -29,9 +30,9 @@ export function MapLayerSettingsPopupButton() { return ( <> - + - + - + Date: Wed, 6 Apr 2022 08:18:36 -0400 Subject: [PATCH 2/6] Fixed bug with elevation correction control. --- extensions/map-layers/src/ui/widget/MapManagerSettings.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/map-layers/src/ui/widget/MapManagerSettings.tsx b/extensions/map-layers/src/ui/widget/MapManagerSettings.tsx index ab3914578647..48bef6437925 100644 --- a/extensions/map-layers/src/ui/widget/MapManagerSettings.tsx +++ b/extensions/map-layers/src/ui/widget/MapManagerSettings.tsx @@ -247,7 +247,8 @@ export function MapManagerSettings() { {heightOriginLabel} - {exaggerationLabel} From a9ea1fef836398c2c8090dcc468ab5aab7ac2917 Mon Sep 17 00:00:00 2001 From: mdastous-bentley Date: Wed, 6 Apr 2022 08:45:22 -0400 Subject: [PATCH 3/6] change log. --- .../geo-maplayers_ui_button_2022-04-06-12-22.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@itwin/map-layers/geo-maplayers_ui_button_2022-04-06-12-22.json diff --git a/common/changes/@itwin/map-layers/geo-maplayers_ui_button_2022-04-06-12-22.json b/common/changes/@itwin/map-layers/geo-maplayers_ui_button_2022-04-06-12-22.json new file mode 100644 index 000000000000..acb211a960ae --- /dev/null +++ b/common/changes/@itwin/map-layers/geo-maplayers_ui_button_2022-04-06-12-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/map-layers", + "comment": "Use iTwinUI-react components to get consistent styling. Alos fixed bug with elevation correction control.", + "type": "none" + } + ], + "packageName": "@itwin/map-layers" +} \ No newline at end of file From e56d66357af9c25068080d5dfc94ca5a52d4c304 Mon Sep 17 00:00:00 2001 From: mdastous-bentley Date: Wed, 6 Apr 2022 14:50:48 -0400 Subject: [PATCH 4/6] No longer override default button styling --- .../src/ui/widget/AttachLayerPopupButton.tsx | 6 +- .../src/ui/widget/BasemapPanel.scss | 10 +- .../map-layers/src/ui/widget/BasemapPanel.tsx | 2 +- .../src/ui/widget/MapLayerDroppable.tsx | 5 +- .../src/ui/widget/MapLayerManager.scss | 115 +----------------- .../src/ui/widget/MapLayerSettingsMenu.tsx | 14 ++- .../widget/MapLayerSettingsPopupButton.scss | 13 -- .../src/ui/widget/SubLayersPopupButton.tsx | 2 +- .../ui/widget/TransparencyPopupButton.scss | 27 ++-- .../src/ui/widget/TransparencyPopupButton.tsx | 2 +- 10 files changed, 33 insertions(+), 163 deletions(-) diff --git a/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx b/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx index 83c495b299c8..8e096f4600dd 100644 --- a/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx +++ b/extensions/map-layers/src/ui/widget/AttachLayerPopupButton.tsx @@ -333,12 +333,16 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: (!!iTwinId && !!iModelId && layerNameUnderCursor && layerNameUnderCursor === source.name) && <> diff --git a/extensions/map-layers/src/ui/widget/BasemapPanel.scss b/extensions/map-layers/src/ui/widget/BasemapPanel.scss index fd183d772fd8..d3ac855a9743 100644 --- a/extensions/map-layers/src/ui/widget/BasemapPanel.scss +++ b/extensions/map-layers/src/ui/widget/BasemapPanel.scss @@ -27,6 +27,7 @@ $hovered-icon-color: $buic-foreground-primary; } .map-manager-base-label { + margin-left: 2px; padding-right: 10px; } @@ -45,15 +46,6 @@ $hovered-icon-color: $buic-foreground-primary; width: 100%; // makes the Select control fill empty space on the right } - .map-manager-base-item-visibility { - border: none; - height: 25px; - &:hover { - background-color: transparent; - color: $hovered-icon-color; - } - } - button.map-manager-base-settings-button { border: none; margin-left: 4px; diff --git a/extensions/map-layers/src/ui/widget/BasemapPanel.tsx b/extensions/map-layers/src/ui/widget/BasemapPanel.tsx index d5abdff21919..a8c3dd8b3f4d 100644 --- a/extensions/map-layers/src/ui/widget/BasemapPanel.tsx +++ b/extensions/map-layers/src/ui/widget/BasemapPanel.tsx @@ -152,7 +152,7 @@ export function BasemapPanel() { return ( <>
- {baseLayerLabel} diff --git a/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx b/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx index 963dabe800a8..555bb46dd7fc 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx +++ b/extensions/map-layers/src/ui/widget/MapLayerDroppable.tsx @@ -54,7 +54,7 @@ export function MapLayerDroppable(props: MapLayerDroppableProps) {
- {activeLayer.name} @@ -65,7 +65,8 @@ export function MapLayerDroppable(props: MapLayerDroppableProps) {
{activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth && + - {labelZoomToLayer} - {labelDetach} - - - +
+ {labelZoomToLayer} + {labelDetach} + + + +
); diff --git a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss index 80d39d7230ef..1c9b8fead83b 100644 --- a/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss +++ b/extensions/map-layers/src/ui/widget/MapLayerSettingsPopupButton.scss @@ -15,20 +15,7 @@ $hovered-icon-color: $buic-foreground-primary; .map-manager-header-buttons-group { .maplayers-settings-popup-button { - color: $buic-foreground-body; - font-size: 20px; - background-color: transparent; - border: none; position: relative; top: 1px; - - &:hover { - color: $hovered-icon-color; - background-color: transparent; - } - - &:focus { - outline: none; - } } } \ No newline at end of file diff --git a/extensions/map-layers/src/ui/widget/SubLayersPopupButton.tsx b/extensions/map-layers/src/ui/widget/SubLayersPopupButton.tsx index 1b72fc7e83c6..70cdf33c5764 100644 --- a/extensions/map-layers/src/ui/widget/SubLayersPopupButton.tsx +++ b/extensions/map-layers/src/ui/widget/SubLayersPopupButton.tsx @@ -45,7 +45,7 @@ export function SubLayersPopupButton({ mapLayerSettings, activeViewport }: SubLa return ( <> - diff --git a/extensions/map-layers/src/ui/widget/TransparencyPopupButton.scss b/extensions/map-layers/src/ui/widget/TransparencyPopupButton.scss index 350fc9a14442..739c9353e6db 100644 --- a/extensions/map-layers/src/ui/widget/TransparencyPopupButton.scss +++ b/extensions/map-layers/src/ui/widget/TransparencyPopupButton.scss @@ -20,27 +20,14 @@ } } -.map-manager-base-item { -.map-transparency-popup-button { - &:hover { - background-color: transparent; - svg.checkered { - fill: $buic-foreground-primary; - } - } - color: $buic-foreground-body; - font-size: $iui-font-size; - height: 2.2em; - border: none; - margin-right: 2px; - .transparent-button { - width: 16px; - height: 16px; - } +.map-transparency-popup-button { +.transparent-button { + width: 16px; + height: 16px; +} - svg.checkered { - fill: $buic-foreground-body; - } +svg.checkered { + fill: $buic-foreground-body; } } \ No newline at end of file diff --git a/extensions/map-layers/src/ui/widget/TransparencyPopupButton.tsx b/extensions/map-layers/src/ui/widget/TransparencyPopupButton.tsx index d0e7d665bd50..2880c2109161 100644 --- a/extensions/map-layers/src/ui/widget/TransparencyPopupButton.tsx +++ b/extensions/map-layers/src/ui/widget/TransparencyPopupButton.tsx @@ -50,7 +50,7 @@ export function TransparencyPopupButton({ transparency, onTransparencyChange, bu return ( <> -