-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Plan rendering inside a timestrip #6852
Changes from all commits
803ac7d
394cd5c
e1380c6
b68f179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ import TimelineObjectView from './TimelineObjectView.vue'; | |
import TimelineAxis from '../../ui/components/TimeSystemAxis.vue'; | ||
import SwimLane from '@/ui/components/swim-lane/SwimLane.vue'; | ||
import { getValidatedData } from '../plan/util'; | ||
import _ from 'lodash'; | ||
|
||
const unknownObjectType = { | ||
definition: { | ||
|
@@ -81,6 +82,7 @@ export default { | |
this.composition.off('remove', this.removeItem); | ||
this.composition.off('reorder', this.reorder); | ||
this.stopFollowingTimeContext(); | ||
this.contentResizeObserver.disconnect(); | ||
}, | ||
mounted() { | ||
this.items = []; | ||
|
@@ -92,6 +94,10 @@ export default { | |
this.composition.on('reorder', this.reorder); | ||
this.composition.load(); | ||
} | ||
|
||
this.handleContentResize = _.debounce(this.handleContentResize, 500); | ||
this.contentResizeObserver = new ResizeObserver(this.handleContentResize); | ||
this.contentResizeObserver.observe(this.$refs.timelineHolder); | ||
}, | ||
methods: { | ||
addItem(domainObject) { | ||
|
@@ -132,18 +138,21 @@ export default { | |
this.items[reorderEvent.newIndex] = oldItems[reorderEvent.oldIndex]; | ||
}); | ||
}, | ||
handleContentResize() { | ||
this.updateContentHeight(); | ||
}, | ||
updateContentHeight() { | ||
const clientHeight = this.getClientHeight(); | ||
if (this.height !== clientHeight) { | ||
this.height = clientHeight; | ||
} | ||
}, | ||
getClientHeight() { | ||
let clientHeight = this.$refs.contentHolder.getBoundingClientRect().height; | ||
let clientHeight = this.$refs.timelineHolder.getBoundingClientRect().height; | ||
|
||
if (!clientHeight) { | ||
//this is a hack - need a better way to find the parent of this component | ||
let parent = this.openmct.layout.$refs.browseObject.$el; | ||
let parent = this.$el.closest('.c-object-view'); | ||
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. can we use $parent here? 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. No we can't. 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. What’s the issue here? |
||
if (parent) { | ||
clientHeight = parent.getBoundingClientRect().height; | ||
} | ||
|
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 can use this guy now instead of importing lodash: https://github.com/nasa/openmct/blob/master/src/utils/debounce.js