-
Notifications
You must be signed in to change notification settings - Fork 1
Rework screenspace renderable panel #233
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
WeirdRubberDuck
wants to merge
47
commits into
master
Choose a base branch
from
feature/screenspace-renderable-update
base: master
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
47 commits
Select commit
Hold shift + click to select a range
8315f2a
WIP: Refactor screenspace renderable list to work more like scene menu
WeirdRubberDuck 704a0cb
Make the add part a bit smaller
WeirdRubberDuck f3e04cb
Make decorated icon more compact, by overlaying a theme icon
WeirdRubberDuck 474429f
Add setting for decorator color
WeirdRubberDuck 42824b7
Merge branch 'features/decorated-icon-update' into feature/screenspac…
WeirdRubberDuck cda4d7e
Use add icons
WeirdRubberDuck 798d64a
Show an icon based on renderable type and make sure to show relevant …
WeirdRubberDuck 17c2eea
Restructure files and start building custom placement component
WeirdRubberDuck 78f7c55
Rough draft of position widget
WeirdRubberDuck 9ba7a77
Add stepping for all number inputs
WeirdRubberDuck 4063f71
Add draft of local rotation input too
WeirdRubberDuck 74f0251
Add tooltips to some action icons
WeirdRubberDuck 8512992
Add a popout button
WeirdRubberDuck af5eaea
Increase size of angle input
WeirdRubberDuck 920ab1c
Merge branch 'master' into feature/screenspace-renderable-update
WeirdRubberDuck 1f074d7
Move popout and remove to a more menu
WeirdRubberDuck b735c39
Refactor placement component
WeirdRubberDuck 993685d
Disable rotation reset if value is 0
WeirdRubberDuck 6e12ca4
Fix wrong icon
WeirdRubberDuck f63e048
Rename hooks file for removal modals
WeirdRubberDuck 7f9ae9c
Move add functionality to a separate modal
WeirdRubberDuck ce6d32b
Add support for loading videos
WeirdRubberDuck 84cc021
handle quotes in file name and add video settings for look and audio
WeirdRubberDuck 59e4153
Add some more icons
WeirdRubberDuck f2976a5
Add option to add text
WeirdRubberDuck db29c6e
Add icon for ScreenSpaceDashboard
WeirdRubberDuck dba61a0
Remove unused include
WeirdRubberDuck 396332a
Make a component to style the vec3 property groups and give them an a…
WeirdRubberDuck 448cffe
Hide distance sub-property for advanced users
WeirdRubberDuck 72c4620
Change icon for resetting local rotation
WeirdRubberDuck f42cf77
Reformat segmented contorl labels
WeirdRubberDuck 55f47ea
Merge branch 'master' into feature/screenspace-renderable-update
WeirdRubberDuck bf12dec
Update an icon
WeirdRubberDuck df53f63
Update docs of hidedn properties again
WeirdRubberDuck df08e30
Make list of renderables a filterlist
WeirdRubberDuck d1f75fe
Filter out gui hidden objects
WeirdRubberDuck 04f5ef4
Make name field not required in add modal
WeirdRubberDuck 12f03e2
Merge branch 'master' into feature/screenspace-renderable-update
WeirdRubberDuck fadd59b
Use NumberInput component for ocnsistent behavior across UI
WeirdRubberDuck 2563356
Add tooltip to test website button
WeirdRubberDuck f6dc22f
Move texts to translation system
WeirdRubberDuck a20abeb
Tiny cleanup
WeirdRubberDuck c2600aa
Small refactor
WeirdRubberDuck 27d7c27
Oops, fix duplicated translations
WeirdRubberDuck 76f5544
Apply suggestions from code review
WeirdRubberDuck b6cafe2
Clarify that text is a tooltip
WeirdRubberDuck 8bd4ba9
Refactor aria labels
WeirdRubberDuck 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,118 @@ | ||
| { | ||
| "display-name-input": { | ||
| "title": "Display name", | ||
| "placeholder": "Slide name" | ||
| }, | ||
| "image-input": { | ||
| "tab-title": "Image", | ||
| "title": "Path or URL to image", | ||
| "placeholder": "Path / URL", | ||
| "button-label": "Add" | ||
| }, | ||
| "website-input": { | ||
| "tab-title": "Website", | ||
| "title": "URL to website", | ||
| "placeholder": "URL", | ||
| "button-label": "Add" | ||
| "add-modal": { | ||
| "button-label": "Add", | ||
| "title": "Add Screenspace Renderable", | ||
| "name-input": { | ||
| "title": "Display name", | ||
| "placeholder": "Enter a name to show in the GUI" | ||
| }, | ||
| "image": { | ||
| "tab-title": "Image", | ||
| "title": "Path or URL to image", | ||
| "placeholder": "C:/path/to/image.png or https://example.com/image.png", | ||
| "error": { | ||
| "title": "Error: invalid base64 encoding format", | ||
| "description": "Cannot parse invalid format '{{format}}', supported base64 encoding images are 'png' and 'jpeg'" | ||
| } | ||
| }, | ||
| "website": { | ||
| "tab-title": "Website", | ||
| "title": "Website URL", | ||
| "placeholder": "https://example.com", | ||
| "test-button": { | ||
| "label": "Test", | ||
| "tooltip": "Test website link (open in browser)" | ||
| } | ||
| }, | ||
| "video": { | ||
| "tab-title": "Video", | ||
| "title": "Path to video file", | ||
| "placeholder": "C:/path/to/video.mp4", | ||
| "loop": { | ||
| "label": "Loop video" | ||
| }, | ||
| "play-audio": { | ||
| "label": "Play audio" | ||
| } | ||
| }, | ||
| "text": { | ||
| "tab-title": "Text", | ||
| "title": "Text content", | ||
| "placeholder": "Enter the text to display" | ||
| }, | ||
| "add-button": { | ||
| "label": "Add", | ||
| "disabled-tooltip": "Please provide some valid content for the Screenspace renderable." | ||
| } | ||
| }, | ||
| "added-slides": { | ||
| "empty-slides": "No active slides", | ||
| "remove-slide-aria-label": "Remove slide" | ||
| "search-placeholder": "Search...", | ||
| "empty": "Add Screenspace renderables to view them here.", | ||
| "tips": "Tip: Try adding an image or video file by dragging and dropping it." | ||
| }, | ||
| "no-selection-hint": "Select an item to view its details", | ||
| "more-menu": { | ||
| "aria-label": "Open more menu", | ||
| "delete-button": { | ||
| "label": "Delete", | ||
| "info": "Remove this Screenspace renderable" | ||
| }, | ||
| "delete-confirm-modal": { | ||
| "title": "Delete Screenspace Renderable", | ||
| "are-you-sure": "Are you sure you want to remove the Screenspace renderable", | ||
| "remove-button": "Remove", | ||
| "cancel-button": "Cancel" | ||
| }, | ||
| "pop-out": "Pop out" | ||
| }, | ||
| "error": { | ||
| "title": "Error: invalid base64 encoding format", | ||
| "description": "Cannot parse invalid format '{{format}}', supported base64 encoding images are 'png' and 'jpeg'" | ||
| "renderable-view": { | ||
| "placement-tab": { | ||
| "title": "Placement", | ||
| "mode-switch": { | ||
| "aria-label": "Placement mode", | ||
| "label-rae": "Spherical (RAE)", | ||
| "label-xyz": "Cartesian (XYZ)" | ||
| }, | ||
| "spherical-controls": { | ||
| "label": "Spherical position", | ||
| "description": "Screenspace position in spherical coordinates (radius, azimuth, elevation). Radius is an advanced property hidden for other user levels. It controls the distance to the screenspace plane, allowing objects to be layered at different depths.", | ||
| "radius": { | ||
| "label": "Radius" | ||
| }, | ||
| "azimuth": { | ||
| "label": "Azimuth" | ||
| }, | ||
| "elevation": { | ||
| "label": "Elevation" | ||
| } | ||
| }, | ||
| "cartesian-controls": { | ||
| "label": "Cartesian position", | ||
| "description": "Screenspace position in Cartesian coordinates (x, y, z). The z-coordinate is an advanced property hidden for other user levels. It controls the distance to the screenspace plane, allowing objects to be layered at different depths." | ||
| }, | ||
| "local-rotation": { | ||
| "label": "Local rotation", | ||
| "roll": { | ||
| "label": "Roll" | ||
| }, | ||
| "pitch": { | ||
| "label": "Pitch" | ||
| }, | ||
| "yaw": { | ||
| "label": "Yaw" | ||
| }, | ||
| "reset-button": { | ||
| "tooltip": "Reset", | ||
| "aria-label": "Reset local rotation" | ||
| } | ||
| } | ||
| }, | ||
| "style-tab": { | ||
| "title": "Style" | ||
| }, | ||
| "renderable-tab": { | ||
| "title": "Renderable", | ||
| "tooltip": "Main properties of the Screenspace renderable, including the ones for the specific type." | ||
| } | ||
| } | ||
| } | ||
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,91 @@ | ||
| import { useEffect, useId, useState } from 'react'; | ||
| import { AngleSlider, Group, Stack } from '@mantine/core'; | ||
| import { useThrottledCallback } from '@mantine/hooks'; | ||
|
|
||
| import { NumericInput } from '@/components/Input/NumericInput/NumericInput'; | ||
|
|
||
| interface Props { | ||
| value: number; // Radians | ||
| label: React.ReactNode; | ||
| onChange?: (value: number) => void; // Radians | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| export function AngleInput({ value, label, onChange, disabled }: Props) { | ||
| const [currentAngle, setCurrentAngle] = useState(radiansToDegrees(value)); | ||
| const [isInteracting, setIsInteracting] = useState(false); | ||
| const throttledNumberInputChange = useThrottledCallback((numericValue: number) => { | ||
| onChange?.(degreesToRadians(numericValue)); | ||
| }, 300); | ||
|
|
||
| const labelId = useId(); | ||
|
|
||
| function radiansToDegrees(radians: number) { | ||
| return (radians * 180) / Math.PI; | ||
| } | ||
|
|
||
| function degreesToRadians(degrees: number) { | ||
| return (degrees * Math.PI) / 180; | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| if (!isInteracting) { | ||
| setCurrentAngle(radiansToDegrees(value)); | ||
| } | ||
| }, [value, isInteracting]); | ||
|
|
||
| return ( | ||
| <Stack gap={2} flex={1} align={'center'}> | ||
| <div id={labelId}>{label}</div> | ||
| <Group align={'center'} justify={'center'} gap={5}> | ||
| <AngleSlider | ||
| marks={[ | ||
| { value: 0 }, | ||
| { value: 45 }, | ||
| { value: 90 }, | ||
| { value: 135 }, | ||
| { value: 180 }, | ||
| { value: 225 }, | ||
| { value: 270 }, | ||
| { value: 315 } | ||
| ]} | ||
| size={50} | ||
| value={currentAngle} | ||
| onChange={(newValue) => { | ||
| setIsInteracting(true); | ||
| setCurrentAngle(newValue); | ||
| onChange?.(degreesToRadians(newValue)); | ||
| }} | ||
| onChangeEnd={() => setIsInteracting(false)} | ||
| formatLabel={(labelValue) => `${Math.round(labelValue)}°`} | ||
| disabled={disabled} | ||
| aria-labelledby={labelId} | ||
| /> | ||
| <NumericInput | ||
| value={currentAngle} | ||
| flex={1} | ||
| miw={50} | ||
| maw={80} | ||
| size={'xs'} | ||
| min={-360} | ||
| max={360} | ||
| step={1} | ||
| decimalScale={1} | ||
| onChange={() => setIsInteracting(true)} | ||
| onEnter={(newValue) => { | ||
| const numericValue = Number(newValue); | ||
| if (numericValue === undefined) { | ||
| return; | ||
| } | ||
| setCurrentAngle(numericValue); | ||
| throttledNumberInputChange(numericValue); | ||
| }} | ||
| onFocus={() => setIsInteracting(true)} | ||
| onBlur={() => setIsInteracting(false)} | ||
| disabled={disabled} | ||
| aria-labelledby={labelId} | ||
| /> | ||
| </Group> | ||
| </Stack> | ||
| ); | ||
| } |
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,15 @@ | ||
| import { usePropertyValue } from '@/hooks/properties'; | ||
| import { PropertyVisibilityNumber } from '@/types/enums'; | ||
|
|
||
| export function useIsAdvancedUserLevel(): boolean { | ||
| const userLevel = usePropertyValue( | ||
| 'OptionProperty', | ||
| 'OpenSpaceEngine.PropertyVisibility' | ||
| ); | ||
|
|
||
| if (userLevel === undefined) { | ||
| throw new Error('User level property is undefined'); | ||
| } | ||
|
Comment on lines
+10
to
+12
|
||
|
|
||
| return userLevel >= PropertyVisibilityNumber.AdvancedUser; | ||
| } | ||
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
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.