mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: Gantt chart bugs (#2024)
* fix: only left mouse button should trigger all the events * fix: extra block shadow
This commit is contained in:
parent
3a0d96a48d
commit
0d4bcd2758
@ -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;
|
||||
@ -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;
|
||||
@ -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();
|
||||
|
||||
@ -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`,
|
||||
|
Loading…
Reference in New Issue
Block a user