mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
M: Remove modficiation tracking
This commit is contained in:
parent
cba8180429
commit
22217899b5
|
@ -7,7 +7,6 @@ import {
|
||||||
getNodesBounds,
|
getNodesBounds,
|
||||||
getViewportForBounds,
|
getViewportForBounds,
|
||||||
Node,
|
Node,
|
||||||
NodeChange,
|
|
||||||
ReactFlow,
|
ReactFlow,
|
||||||
useEdgesState,
|
useEdgesState,
|
||||||
useNodesState,
|
useNodesState,
|
||||||
|
@ -22,7 +21,6 @@ import { useLibrary } from '@/features/library';
|
||||||
import { Overlay } from '@/components/Container';
|
import { Overlay } from '@/components/Container';
|
||||||
import { CProps } from '@/components/props';
|
import { CProps } from '@/components/props';
|
||||||
import { useMainHeight } from '@/stores/appLayout';
|
import { useMainHeight } from '@/stores/appLayout';
|
||||||
import { useModificationStore } from '@/stores/modification';
|
|
||||||
import { useTooltipsStore } from '@/stores/tooltips';
|
import { useTooltipsStore } from '@/stores/tooltips';
|
||||||
import { APP_COLORS } from '@/styling/colors';
|
import { APP_COLORS } from '@/styling/colors';
|
||||||
import { PARAMETER } from '@/utils/constants';
|
import { PARAMETER } from '@/utils/constants';
|
||||||
|
@ -61,7 +59,6 @@ export function OssFlow() {
|
||||||
const router = useConceptNavigation();
|
const router = useConceptNavigation();
|
||||||
const { items: libraryItems } = useLibrary();
|
const { items: libraryItems } = useLibrary();
|
||||||
const flow = useReactFlow();
|
const flow = useReactFlow();
|
||||||
const { setIsModified } = useModificationStore();
|
|
||||||
|
|
||||||
const isProcessing = useMutatingOss();
|
const isProcessing = useMutatingOss();
|
||||||
|
|
||||||
|
@ -116,11 +113,7 @@ export function OssFlow() {
|
||||||
: 'left'
|
: 'left'
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
}, [schema, setNodes, setEdges, toggleReset, edgeStraight, edgeAnimate]);
|
||||||
setTimeout(() => {
|
|
||||||
setIsModified(false);
|
|
||||||
}, PARAMETER.graphRefreshDelay);
|
|
||||||
}, [schema, setNodes, setEdges, setIsModified, toggleReset, edgeStraight, edgeAnimate]);
|
|
||||||
|
|
||||||
function getPositions() {
|
function getPositions() {
|
||||||
return nodes.map(node => ({
|
return nodes.map(node => ({
|
||||||
|
@ -130,13 +123,6 @@ export function OssFlow() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNodesChange(changes: NodeChange[]) {
|
|
||||||
if (isMutable && changes.some(change => change.type === 'position' && change.position)) {
|
|
||||||
setIsModified(true);
|
|
||||||
}
|
|
||||||
onNodesChange(changes);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSavePositions() {
|
function handleSavePositions() {
|
||||||
const positions = getPositions();
|
const positions = getPositions();
|
||||||
void updatePositions({ itemID: schema.id, positions: positions }).then(() => {
|
void updatePositions({ itemID: schema.id, positions: positions }).then(() => {
|
||||||
|
@ -147,7 +133,6 @@ export function OssFlow() {
|
||||||
operation.position_y = item.position_y;
|
operation.position_y = item.position_y;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setIsModified(false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +326,7 @@ export function OssFlow() {
|
||||||
<ReactFlow
|
<ReactFlow
|
||||||
nodes={nodes}
|
nodes={nodes}
|
||||||
edges={edges}
|
edges={edges}
|
||||||
onNodesChange={handleNodesChange}
|
onNodesChange={onNodesChange}
|
||||||
onEdgesChange={onEdgesChange}
|
onEdgesChange={onEdgesChange}
|
||||||
onNodeDoubleClick={handleNodeDoubleClick}
|
onNodeDoubleClick={handleNodeDoubleClick}
|
||||||
edgesFocusable={false}
|
edgesFocusable={false}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import {
|
||||||
IconReset,
|
IconReset,
|
||||||
IconSave
|
IconSave
|
||||||
} from '@/components/Icons';
|
} from '@/components/Icons';
|
||||||
import { useModificationStore } from '@/stores/modification';
|
|
||||||
import { PARAMETER } from '@/utils/constants';
|
import { PARAMETER } from '@/utils/constants';
|
||||||
import { prepareTooltip } from '@/utils/utils';
|
import { prepareTooltip } from '@/utils/utils';
|
||||||
|
|
||||||
|
@ -51,7 +50,6 @@ export function ToolbarOssGraph({
|
||||||
onResetPositions
|
onResetPositions
|
||||||
}: ToolbarOssGraphProps) {
|
}: ToolbarOssGraphProps) {
|
||||||
const { schema, selected, isMutable, canDelete } = useOssEdit();
|
const { schema, selected, isMutable, canDelete } = useOssEdit();
|
||||||
const { isModified } = useModificationStore();
|
|
||||||
const isProcessing = useMutatingOss();
|
const isProcessing = useMutatingOss();
|
||||||
const selectedOperation = schema.operationByID.get(selected[0]);
|
const selectedOperation = schema.operationByID.get(selected[0]);
|
||||||
|
|
||||||
|
@ -145,7 +143,7 @@ export function ToolbarOssGraph({
|
||||||
<MiniButton
|
<MiniButton
|
||||||
titleHtml={prepareTooltip('Сохранить изменения', 'Ctrl + S')}
|
titleHtml={prepareTooltip('Сохранить изменения', 'Ctrl + S')}
|
||||||
icon={<IconSave size='1.25rem' className='icon-primary' />}
|
icon={<IconSave size='1.25rem' className='icon-primary' />}
|
||||||
disabled={isProcessing || !isModified}
|
disabled={isProcessing}
|
||||||
onClick={onSavePositions}
|
onClick={onSavePositions}
|
||||||
/>
|
/>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
|
|
Loading…
Reference in New Issue
Block a user