Skip to content

Commit

Permalink
fix(GcodePreview): hide exclude objects if no parts
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Jan 21, 2025
1 parent f446b32 commit d53e1d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/components/widgets/gcode-preview/GcodePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,16 @@ export default class GcodePreview extends Mixins(StateMixin, BrowserMixin) {
return this.panning ? 'optimizeSpeed' : 'geometricPrecision'
}
get showExcludeObjects () {
if (!this.klippyReady || !(this.printerPrinting || this.printerPaused)) return false
get hasParts (): boolean {
return this.$store.getters['parts/getHasParts'] as boolean
}
get showExcludeObjects (): boolean {
if (!this.hasParts) {
return false
}
const file = this.$store.getters['gcodePreview/getFile'] as AppFile | undefined
const file = this.file
if (!file) {
return true
Expand Down
6 changes: 3 additions & 3 deletions src/components/widgets/status/StatusControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export default class StatusControls extends Mixins(StateMixin) {
}
get supportsHistoryComponent (): boolean {
return this.$store.getters['server/componentSupport']('history')
return this.$store.getters['server/componentSupport']('history') as boolean
}
get hasParts () {
return Object.keys(this.$store.getters['parts/getParts']).length > 0
get hasParts (): boolean {
return this.$store.getters['parts/getHasParts'] as boolean
}
resetFile () {
Expand Down
4 changes: 4 additions & 0 deletions src/store/parts/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const getters: GetterTree<PartsState, RootState> = {
return state.parts
},

getHasParts: (state): boolean => {
return Object.keys(state.parts).length > 0
},

getIsPartCurrent: (state) => (partName: string): boolean => {
return state.currentPart === partName
},
Expand Down

0 comments on commit d53e1d6

Please sign in to comment.