Skip to content

Commit

Permalink
fix: Gantt chart bugs (#2024)
Browse files Browse the repository at this point in the history
* fix: only left mouse button should trigger all the events

* fix: extra block shadow
  • Loading branch information
aaryan610 committed Sep 1, 2023
1 parent 3a0d96a commit 0d4bcd2
Showing 1 changed file with 9 additions and 3 deletions.
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

1 comment on commit 0d4bcd2

@vercel
Copy link

@vercel vercel bot commented on 0d4bcd2 Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./apps/app

plane-dev-git-develop-plane.vercel.app
plane-dev-plane.vercel.app
plane-dev.vercel.app

Please sign in to comment.