|
|
|
|
@ -462,11 +462,18 @@ const attachPlanBarDrag = (bar: HTMLElement, plan: any, task: any) => {
|
|
|
|
|
if (!moved) return
|
|
|
|
|
moved = false
|
|
|
|
|
|
|
|
|
|
saveUndoSnapshot()
|
|
|
|
|
|
|
|
|
|
const dx = e.clientX - startX
|
|
|
|
|
const newLeft = Math.max(0, startLeft + dx)
|
|
|
|
|
const newStartDate = gantt.dateFromPos(newLeft)
|
|
|
|
|
|
|
|
|
|
if (!newStartDate || !dayjs(newStartDate).isValid()) {
|
|
|
|
|
message.warning(t('GanttChart.GanttPanel.warningDragOutOfRange'))
|
|
|
|
|
initGanttPreview()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveUndoSnapshot()
|
|
|
|
|
|
|
|
|
|
const planDuration = dayjs(plan.planEndTimeStr).diff(dayjs(plan.planStartTimeStr), 'millisecond')
|
|
|
|
|
const newEndDate = new Date(newStartDate.getTime() + planDuration)
|
|
|
|
|
|
|
|
|
|
@ -568,13 +575,19 @@ const attachPlanBarResize = (bar: HTMLElement, plan: any, task: any) => {
|
|
|
|
|
resizing = false
|
|
|
|
|
bar.style.zIndex = '2'
|
|
|
|
|
|
|
|
|
|
saveUndoSnapshot()
|
|
|
|
|
|
|
|
|
|
const newLeft = parseFloat(bar.style.left) || startLeft
|
|
|
|
|
const newWidth = parseFloat(bar.style.width) || startWidth
|
|
|
|
|
const newStartDate = gantt.dateFromPos(newLeft)
|
|
|
|
|
const newEndDate = gantt.dateFromPos(newLeft + newWidth)
|
|
|
|
|
|
|
|
|
|
if (!newStartDate || !newEndDate || !dayjs(newStartDate).isValid() || !dayjs(newEndDate).isValid()) {
|
|
|
|
|
message.warning(t('GanttChart.GanttPanel.warningDragOutOfRange'))
|
|
|
|
|
initGanttPreview()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveUndoSnapshot()
|
|
|
|
|
|
|
|
|
|
const identity = makePlanIdentity(plan)
|
|
|
|
|
const original = findOriginalPlan(identity)
|
|
|
|
|
if (original) {
|
|
|
|
|
|