- 
                Notifications
    
You must be signed in to change notification settings  - Fork 9
 
Add indicator of zoomLevel and datasetLevel to map #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            clarasb
  wants to merge
  29
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
clarasb-287-add_zoom_level
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            29 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      d537eb0
              
                add ZoomBox with zoomLevel
              
              
                clarasb 3bffd99
              
                zoom level - round decimal digits
              
              
                clarasb 7c5f09a
              
                add ZoomBox.stories.tsx
              
              
                clarasb 50f15fd
              
                add DatasetLevel
              
              
                clarasb 40b9941
              
                update ZoomBox
              
              
                clarasb 9a99488
              
                update CHANGES.md
              
              
                clarasb bda8644
              
                update ZoomBox.tsx
              
              
                clarasb dcaaa05
              
                update ZoomBox.tsx
              
              
                clarasb 1257ebf
              
                add dataset levels info to Info-Panel
              
              
                clarasb 25821b4
              
                change position and layout of box
              
              
                clarasb b9e01c3
              
                add visibility control for zoomBox
              
              
                clarasb 7f2e7c3
              
                update styling - remove shadow
              
              
                clarasb ebd5577
              
                Apply suggestions from code review
              
              
                clarasb f3aa1ec
              
                create ZoomBox directory, update Settings Dialog and add translations
              
              
                clarasb 820afc8
              
                add getDatasetLevelSelector
              
              
                clarasb 38e22f1
              
                add zoomLevel to controlState
              
              
                clarasb ef8bd91
              
                fix typing
              
              
                clarasb c3dec9c
              
                add description to getDatasetLevel()
              
              
                clarasb 3d0f422
              
                save DatasetZLevel in controlState
              
              
                clarasb 2194032
              
                Merge branch 'main' into clarasb-287-add_zoom_level
              
              
                clarasb 6781643
              
                rename ZoomBox to ZoomInfoBox and extend the information on dataset l…
              
              
                clarasb fb0edca
              
                update setZoomLevel and add setDatasetZLevel
              
              
                clarasb eff2a4b
              
                add setDatasetZLevel to hook dependency
              
              
                clarasb ab7f31a
              
                rename showZoomBox to showZoomInfoBox
              
              
                clarasb 5eab41d
              
                formatting
              
              
                clarasb d842ea7
              
                update description for getDatasetLevel
              
              
                clarasb b0db37a
              
                add zoom information box to documentation
              
              
                clarasb 7de1aee
              
                Merge branch 'main' into clarasb-287-add_zoom_level
              
              
                clarasb cd1f58c
              
                update ZoomInfoBox.stories.tsx
              
              
                clarasb File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -493,6 +493,52 @@ A list of all the features that the viewer contains will be created here, in whi | |||||
| </tbody> | ||||||
| </table> | ||||||
| 
     | 
||||||
| ### Zoom Information Box | ||||||
| 
     | 
||||||
| <table> | ||||||
| <thead> | ||||||
| <tr> | ||||||
| <th colspan="2"> | ||||||
| <img src="../assets/images/zoom_infobox.png" alt="Zoom Infobox" /> | ||||||
| </th> | ||||||
| </tr> | ||||||
| </thead> | ||||||
| <tbody> | ||||||
| <tr> | ||||||
| <td><b>Feature Name</b></td> | ||||||
| <td>Zoom Information Box</td> | ||||||
| </tr> | ||||||
| <tr> | ||||||
| <td><b>Description</b></td> | ||||||
| <td> | ||||||
| Displays an information box that showing the current | ||||||
| zoom level of the map and the dataset resolution level (particularly | ||||||
| useful for multi-resolution dataset) used for displaying the dataset | ||||||
| in the map. | ||||||
| </td> | ||||||
| </tr> | ||||||
| <tr></tr> | ||||||
| <tr> | ||||||
| <td><b>Functionality</b></td> | ||||||
| <td> | ||||||
| The visibility of this feature can be controlled in the | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
  | 
||||||
| <a | ||||||
| href="../user_guide/settings" | ||||||
| rel="noopener noreferrer" | ||||||
| >settings</a | ||||||
| >. | ||||||
| The initial visibility can be set in the Viewer configuration. | ||||||
| </td> | ||||||
| </tr> | ||||||
| <tr> | ||||||
| <td><b>Aim</b></td> | ||||||
| <td>Enable users to quickly access information about the zoom and dataset | ||||||
| level. | ||||||
| </td> | ||||||
| </tr> | ||||||
| </tbody> | ||||||
| </table> | ||||||
| 
     | 
||||||
| ### Share Permalink | ||||||
| 
     | 
||||||
| <table> | ||||||
| 
          
            
          
           | 
    ||||||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import ZoomInfoBox from "./ZoomInfoBox"; | ||
| 
     | 
||
| const meta: Meta = { | ||
| component: ZoomInfoBox, | ||
| title: "ZoomInfoBox", | ||
| parameters: { | ||
| // Optional parameter to center the component in the Canvas. | ||
| // More info: https://storybook.js.org/docs/configure/story-layout | ||
| layout: "centered", | ||
| }, | ||
| // This component will have an automatically generated Autodocs entry: | ||
| // https://storybook.js.org/docs/writing-docs/autodocs | ||
| tags: ["autodocs"], | ||
| } satisfies Meta<typeof ZoomInfoBox>; | ||
| 
     | 
||
| // noinspection JSUnusedGlobalSymbols | ||
| export default meta; | ||
| 
     | 
||
| type Story = StoryObj<typeof meta>; | ||
| 
     | 
||
| // noinspection JSUnusedGlobalSymbols | ||
| export const Default: Story = { | ||
| args: { | ||
| style: {}, | ||
| zoomLevel: 10, | ||
| datasetLevel: 3, | ||
| datasetLevels: 4, | ||
| visibility: true, | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* | ||
| * Copyright (c) 2019-2025 by xcube team and contributors | ||
| * Permissions are hereby granted under the terms of the MIT License: | ||
| * https://opensource.org/licenses/MIT. | ||
| */ | ||
| 
     | 
||
| import { CSSProperties } from "react"; | ||
| import { alpha } from "@mui/material/styles"; | ||
| import Box from "@mui/material/Box"; | ||
| import Divider from "@mui/material/Divider"; | ||
| import Typography from "@mui/material/Typography"; | ||
| 
     | 
||
| import { getLabelForValue } from "@/util/label"; | ||
| import { makeStyles } from "@/util/styles"; | ||
| import { getBorderStyle } from "@/components/ColorBarLegend/style"; | ||
| 
     | 
||
| const styles = makeStyles({ | ||
| container: (theme) => ({ | ||
| position: "absolute", | ||
| zIndex: 1000, | ||
| border: getBorderStyle(theme), | ||
| borderRadius: "4px", | ||
| backgroundColor: alpha(theme.palette.background.default, 0.85), | ||
| minWidth: "120px", | ||
| paddingLeft: theme.spacing(1.5), | ||
| paddingRight: theme.spacing(1.5), | ||
| paddingBottom: theme.spacing(0.5), | ||
| paddingTop: theme.spacing(0.5), | ||
| display: "flex", | ||
| flexDirection: "row", | ||
| justifyContent: "space-between", | ||
| gap: 1, | ||
| }), | ||
| title: { | ||
| fontSize: "0.8rem", | ||
| fontWeight: "normal", | ||
| wordBreak: "break-word", | ||
| wordWrap: "break-word", | ||
| }, | ||
| subTitle: { | ||
| fontSize: "0.7rem", | ||
| fontWeight: "lighter", | ||
| wordBreak: "break-word", | ||
| wordWrap: "break-word", | ||
| }, | ||
| }); | ||
| 
     | 
||
| interface ZoomInfoBoxProps { | ||
| style: CSSProperties; | ||
| zoomLevel: number | undefined; | ||
| datasetLevel: number | undefined; | ||
| datasetLevels: number; | ||
| visibility: boolean; | ||
| } | ||
| 
     | 
||
| export default function ZoomInfoBox({ | ||
| style, | ||
| zoomLevel, | ||
| datasetLevel, | ||
| datasetLevels, | ||
| visibility, | ||
| }: ZoomInfoBoxProps): JSX.Element | null { | ||
| if (!visibility) { | ||
| return null; | ||
| } | ||
| 
     | 
||
| return ( | ||
| <div> | ||
| <Box | ||
| //className="ol-unselectable ol-control" | ||
| sx={styles.container} | ||
| style={style} | ||
| > | ||
| <Box> | ||
| <Typography sx={styles.title} variant="subtitle1" color="textPrimary"> | ||
| {"Zoom"} | ||
| </Typography> | ||
| <Typography | ||
| sx={styles.subTitle} | ||
| variant="subtitle2" | ||
| color="textPrimary" | ||
| > | ||
| {zoomLevel !== undefined | ||
| ? getLabelForValue(zoomLevel, 4) | ||
| : "no zoom level"} | ||
| </Typography> | ||
| </Box> | ||
| <Divider orientation="vertical" flexItem /> | ||
| <Box> | ||
| <Typography sx={styles.title} variant="subtitle1" color="textPrimary"> | ||
| {"Level"} | ||
| </Typography> | ||
| <Typography | ||
| sx={styles.subTitle} | ||
| variant="subtitle2" | ||
| color="textPrimary" | ||
| > | ||
| {/* increment datasetLevel with +1, so that the dataset level range | ||
| starts with 1 instead of 0.*/} | ||
| {datasetLevel !== undefined | ||
| ? getLabelForValue(datasetLevel + 1, 0) + | ||
| " / " + | ||
| getLabelForValue(datasetLevels, 0) | ||
| : "no dataset level"} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
| </div> | ||
| ); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /* | ||
| * Copyright (c) 2019-2025 by xcube team and contributors | ||
| * Permissions are hereby granted under the terms of the MIT License: | ||
| * https://opensource.org/licenses/MIT. | ||
| */ | ||
| 
     | 
||
| import ZoomInfoBox from "./ZoomInfoBox"; | ||
| 
     | 
||
| export default ZoomInfoBox; | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.