Skip to content
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