Skip to content

Commit

Permalink
Render GrampsjsFaces even if face_detection fails (fixes #424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegeri committed Apr 17, 2024
1 parent 0e5254b commit 5c2e605
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/GrampsjsConnectedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class GrampsjsConnectedComponent extends GrampsjsTranslateMixin(
super()
this.loading = true
this.error = false
this.renderOnError = false
this.loadWithoutLocale = false
this._errorMessage = ''
this._data = {}
Expand All @@ -47,7 +48,9 @@ export class GrampsjsConnectedComponent extends GrampsjsTranslateMixin(
detail: {message: this._errorMessage},
})
)
return ''
if (!this.renderOnError) {
return ''
}
}
if (this.loading) {
return this.renderLoading()
Expand Down
4 changes: 4 additions & 0 deletions src/components/GrampsjsFaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export class GrampsjsFaces extends GrampsjsConnectedComponent {

// slightly grow rectangles and make them rectangular
_getFaces() {
if (!this._data.data) {
return []
}
return this._data.data.map(rect => {
const [left, top, right, bottom] = rect
const width = right - left
Expand Down Expand Up @@ -65,6 +68,7 @@ export class GrampsjsFaces extends GrampsjsConnectedComponent {
this.selectedRect = []
this.deletedRects = []
this.rectHidden = false
this.renderOnError = true // render even if face detection fails
}

getUrl() {
Expand Down

0 comments on commit 5c2e605

Please sign in to comment.