-
Notifications
You must be signed in to change notification settings - Fork 441
Fix #11304 Improving timeline layout #11319
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
subashtiwari1010
wants to merge
1
commit into
geosolutions-it:master
Choose a base branch
from
subashtiwari1010:fix-11304/timeline-plugin
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
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
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 |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ import TimelineToggle from './timeline/TimelineToggle'; | |
| import ButtonRB from '../components/misc/Button'; | ||
| import { isTimelineVisible } from "../utils/LayersUtils"; | ||
| import Loader from '../components/misc/Loader'; | ||
| import { getExpandedTray } from '../selectors/widgets'; | ||
|
|
||
| const Button = tooltip(ButtonRB); | ||
|
|
||
|
|
@@ -103,7 +104,8 @@ const TimelinePlugin = compose( | |
| rangeSelector, | ||
| (state) => state.timeline?.loader !== undefined, | ||
| selectedLayerSelector, | ||
| (visible, layers, currentTime, currentTimeRange, offsetEnabled, playbackRange, status, viewRange, timelineIsReady, selectedLayer) => ({ | ||
| getExpandedTray, | ||
| (visible, layers, currentTime, currentTimeRange, offsetEnabled, playbackRange, status, viewRange, timelineIsReady, selectedLayer, expandedWidgetTray) => ({ | ||
| visible, | ||
| layers, | ||
| currentTime, | ||
|
|
@@ -113,7 +115,8 @@ const TimelinePlugin = compose( | |
| status, | ||
| viewRange, | ||
| timelineIsReady, | ||
| selectedLayer | ||
| selectedLayer, | ||
| expandedWidgetTray | ||
| }) | ||
| ), { | ||
| setCurrentTime: selectTime, | ||
|
|
@@ -129,6 +132,7 @@ const TimelinePlugin = compose( | |
| withState('options', 'setOptions', ({expandedPanel}) => { | ||
| return { collapsed: !expandedPanel }; | ||
| }), | ||
| withState('rightOffset', 'setRightOffset', 0), | ||
| // add mapSync button handler and value | ||
| connect( | ||
| createSelector(isMapSync, mapSync => ({mapSync})), | ||
|
|
@@ -156,8 +160,8 @@ const TimelinePlugin = compose( | |
| endValuesSupport: undefined, | ||
| style: { | ||
| marginBottom: 35, | ||
| marginLeft: 100, | ||
| marginRight: 80 | ||
| marginLeft: 55, | ||
| marginRight: 55 | ||
| } | ||
| }), | ||
| // get info about expand, collapse panel | ||
|
|
@@ -218,7 +222,10 @@ const TimelinePlugin = compose( | |
| initialSnap = 'now', | ||
| resetButton, | ||
| reset = () => {}, | ||
| selectedLayer | ||
| selectedLayer, | ||
| rightOffset, | ||
| setRightOffset, | ||
| expandedWidgetTray | ||
| }) => { | ||
| useEffect(()=>{ | ||
| // update state with configs coming from configuration file like localConfig.json so that can be used as props initializer | ||
|
|
@@ -227,6 +234,16 @@ const TimelinePlugin = compose( | |
|
|
||
| const { hideLayersName, collapsed } = options; | ||
|
|
||
| useEffect(() => { | ||
| if (collapsed) return; | ||
| const widgetsTrayElement = document.querySelector('.widgets-tray'); | ||
| if (widgetsTrayElement) { | ||
| const dims = widgetsTrayElement.getBoundingClientRect(); | ||
| // set the right offset to the left of the widgets tray with some margin to avoid overlap | ||
| setRightOffset(window.innerWidth - dims.left - style.marginRight + 10); | ||
| } | ||
| }, [collapsed, style, expandedWidgetTray]); | ||
|
|
||
| const playbackItem = head(items && items.filter(item => item.name === 'playback')); | ||
| const Playback = playbackItem && playbackItem.plugin; | ||
|
|
||
|
|
@@ -266,7 +283,7 @@ const TimelinePlugin = compose( | |
| marginBottom: 35, | ||
| marginLeft: 100, | ||
| ...style, | ||
| right: collapsed ? 'auto' : (style.right || 0) | ||
| right: collapsed ? 'auto' : (rightOffset || style.right || 0) | ||
|
Contributor
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. We should use the logic already implemented for the style.right maplayout selctor if possible instead to add a new rightOffset variable |
||
| }} | ||
| className={`timeline-plugin${hideLayersName ? ' hide-layers-name' : ''}${offsetEnabled ? ' with-time-offset' : ''} ${!isTimelineVisible(layers) ? 'hidden' : ''}`}> | ||
|
|
||
|
|
||
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
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.
We should not compute inside a side effect the size of plugin inside another plugin. Plugins implementations in general shouldn't know about other plugins.
The
style.rightposition is computed inside the maplayout selector . We should investigate if we can use the logic already implemented inside the maplayout epic that controls the right position based also on side panel state