Skip to content

Commit

Permalink
Fix parent triangle in descendant chart
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Oct 24, 2023
1 parent 0631bc9 commit 4fda27b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/GrampsjsTreeChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class GrampsjsTreeChart extends GrampsjsTranslateMixin(LitElement) {
<div id="container">
${TreeChart(data, {
depth: this.depth,
childrenTriangle: this._hasChildren(),
childrenTriangle: this.descendants
? this._hasParents()
: this._hasChildren(),
getImageUrl: d => getImageUrl(d?.data?.person || {}, 200),
orientation: this.descendants ? 'RTL' : 'LTR',
gapX: this.gapX,
Expand All @@ -100,6 +102,15 @@ class GrampsjsTreeChart extends GrampsjsTranslateMixin(LitElement) {
return false
}

_hasParents() {
const {handle} = getPersonByGrampsId(this.data, this.grampsId)
const data = getTree(this.data, handle, 2, false)
if (data.children && data.children.length) {
return true
}
return false
}

renderChildrenMenu() {
const {handle} = getPersonByGrampsId(this.data, this.grampsId)
const data = this.descendants
Expand Down

0 comments on commit 4fda27b

Please sign in to comment.