mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: block position calculator improved
This commit is contained in:
parent
a6d904593e
commit
ea3f13b540
@ -57,13 +57,14 @@ export const YearChartView: FC<any> = () => {
|
||||
className="relative flex h-full flex-col overflow-hidden whitespace-nowrap"
|
||||
style={{ width: `${currentViewData?.data.width}px` }}
|
||||
>
|
||||
<div
|
||||
<div className="relative h-full w-full flex-1 flex justify-center">
|
||||
{/* <div
|
||||
className={`relative h-full w-full flex-1 flex justify-center ${
|
||||
["sat", "sun"].includes(monthWeek?.dayData?.shortTitle || "")
|
||||
? `bg-custom-background-90`
|
||||
: ``
|
||||
}`}
|
||||
>
|
||||
> */}
|
||||
{/* {monthDay?.today && (
|
||||
<div className="absolute top-0 bottom-0 w-[1px] bg-red-500" />
|
||||
)} */}
|
||||
|
@ -156,12 +156,12 @@ export const getYearChartItemPositionWidthInYear = (
|
||||
|
||||
// position code starts
|
||||
const positionTimeDifference: number = startDate.getTime() - itemStartDate.getTime();
|
||||
const positionDaysDifference: number = Math.abs(
|
||||
Math.floor(positionTimeDifference / (1000 * 60 * 60 * 24))
|
||||
const positionWeeksDifference: number = Math.abs(
|
||||
Math.floor(positionTimeDifference / (1000 * 60 * 60 * 24 * 7))
|
||||
);
|
||||
scrollPosition = positionDaysDifference * chartData.data.width;
|
||||
scrollPosition = positionWeeksDifference * chartData.data.width;
|
||||
|
||||
var diffMonths = (itemStartDate.getFullYear() - startDate.getFullYear()) * 12;
|
||||
let diffMonths = (itemStartDate.getFullYear() - startDate.getFullYear()) * 12;
|
||||
diffMonths -= startDate.getMonth();
|
||||
diffMonths += itemStartDate.getMonth();
|
||||
|
||||
@ -171,7 +171,7 @@ export const getYearChartItemPositionWidthInYear = (
|
||||
// width code starts
|
||||
const widthTimeDifference: number = itemStartDate.getTime() - itemTargetDate.getTime();
|
||||
const widthDaysDifference: number = Math.abs(
|
||||
Math.floor(widthTimeDifference / (1000 * 60 * 60 * 24))
|
||||
Math.floor(widthTimeDifference / (1000 * 60 * 60 * 24 * 7))
|
||||
);
|
||||
scrollWidth = (widthDaysDifference + 1) * chartData.data.width + 1;
|
||||
// width code ends
|
||||
|
Loading…
Reference in New Issue
Block a user