Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Gantt chart bugs #2024

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/app/components/gantt-chart/helpers/draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ export const ChartDraggable: React.FC<Props> = ({
};

// handle block resize from the left end
const handleBlockLeftResize = () => {
const handleBlockLeftResize = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
if (!currentViewData || !resizableRef.current || !block.position) return;

if (e.button !== 0) return;

const resizableDiv = resizableRef.current;

const columnWidth = currentViewData.data.width;
Expand Down Expand Up @@ -126,9 +128,11 @@ export const ChartDraggable: React.FC<Props> = ({
};

// handle block resize from the right end
const handleBlockRightResize = () => {
const handleBlockRightResize = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
if (!currentViewData || !resizableRef.current || !block.position) return;

if (e.button !== 0) return;

const resizableDiv = resizableRef.current;

const columnWidth = currentViewData.data.width;
Expand Down Expand Up @@ -173,6 +177,8 @@ export const ChartDraggable: React.FC<Props> = ({
const handleBlockMove = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
if (!enableBlockMove || !currentViewData || !resizableRef.current || !block.position) return;

if (e.button !== 0) return;

e.preventDefault();
e.stopPropagation();

Expand Down Expand Up @@ -266,7 +272,7 @@ export const ChartDraggable: React.FC<Props> = ({
<div
id={`block-${block.id}`}
ref={resizableRef}
className="relative group cursor-pointer font-medium rounded shadow-sm h-full inline-flex items-center transition-all"
className="relative group cursor-pointer font-medium h-full inline-flex items-center transition-all"
style={{
marginLeft: `${block.position?.marginLeft}px`,
width: `${block.position?.width}px`,
Expand Down
Loading