Skip to content

Commit

Permalink
kup-planner: fixed phase d&d overlap with double view
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiren12345 committed Mar 6, 2024
1 parent 388d706 commit ac3481c
Showing 1 changed file with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,24 +417,49 @@ export class KupGridRenderer {
this.dropZoneTask = dropAllowedOn.find(task => this.isPhaseWithinTaskArea(changedTask, task))

if (this.dropZoneTask?.ySecondary) {
const rects = this.svg.querySelectorAll(`.barWrapper[data-type="${this.dropZoneTask.type}"] rect[y='${this.dropZoneTask.ySecondary}']`)

rects.forEach(rect => {
const rects = this.getBarRectsForDropzoneVisualization();
rects.forEach((rect: Element) => {
rect.setAttribute('fill', defaultStylingOptions.barDropZoneColor)
})
}
}

resetDropzoneVisualization() {
if (!this.dropZoneTask) return;
const rects = this.svg.querySelectorAll(`.barWrapper[data-type="${this.dropZoneTask.type}"] rect[y='${this.dropZoneTask.ySecondary}']`)
const rects = this.getBarRectsForDropzoneVisualization();

const isSelected = !!this.selectedTask && this.dropZoneTask.id === this.selectedTask.id
rects.forEach(rect => {
rects.forEach((rect: Element) => {
rect.setAttribute('fill', this.getBarColor(isSelected, this.dropZoneTask.styles))
})
}

getBarRectsForDropzoneVisualization(): Element[] | NodeListOf<Element> {
let rects: Element[] | NodeListOf<Element>;

if (!this.showSecondaryDates) {
rects = this.svg.querySelectorAll(`.barWrapper[data-type="${this.dropZoneTask.type}"] rect[y='${this.dropZoneTask.ySecondary}']`);
} else {
const rect = this.svg.querySelector(`.barWrapper[data-type="${this.dropZoneTask.type}"] rect[y='${this.dropZoneTask.ySecondary}']`);
const siblings = [rect];
let nextSibling = rect.nextElementSibling;
while (nextSibling !== null) {
siblings.push(nextSibling);
nextSibling = nextSibling.nextElementSibling;
}

let prevSibling = rect.previousElementSibling;
while (prevSibling !== null) {
siblings.unshift(prevSibling);
prevSibling = prevSibling.previousElementSibling;
}

rects = siblings;
}

return rects;
}

handleBarEventStart(
action: KupPlannerGanttContentMoveAction,
task: KupPlannerBarTask,
Expand Down Expand Up @@ -1144,6 +1169,18 @@ export class KupGridRenderer {
</g>
);
})}
{this.currentTarget && this.ganttEvent.changedTask && (
<g class="task-wrapper">
{
this.renderKupBar(
this.ganttEvent.changedTask,
false,
false,
false
)
}
</g>
)}
</g>
</g>
</svg>
Expand Down

0 comments on commit ac3481c

Please sign in to comment.