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

Изменение цвета перехода от начального элемента #387

Merged
merged 38 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7c54241
Поддержка Arduino Micro
Roundabout1 Feb 4, 2024
834e372
Поддержка Arduino Micro
Roundabout1 Feb 4, 2024
df251d8
Merge branch 'main' of https://github.com/Roundabout1/lapki-client
Roundabout1 Feb 4, 2024
c125f7a
Более стабильная версия загрузчика
Roundabout1 Feb 5, 2024
5728467
Merge remote-tracking branch 'upstream/main'
Roundabout1 Feb 9, 2024
fe51f21
Merge remote-tracking branch 'upstream/main'
Roundabout1 Feb 27, 2024
95496ce
Merge remote-tracking branch 'upstream/main'
Roundabout1 Mar 25, 2024
b24bfbe
Merge branch 'main' of https://github.com/Roundabout1/lapki-client
Roundabout1 Mar 25, 2024
4ee73a0
Merge remote-tracking branch 'upstream/main'
Roundabout1 Mar 26, 2024
6ad0306
Merge remote-tracking branch 'upstream/main'
Roundabout1 Apr 9, 2024
46429c5
Merge remote-tracking branch 'upstream/main'
Roundabout1 Apr 18, 2024
aa6e491
Merge remote-tracking branch 'upstream/main'
Roundabout1 May 7, 2024
52576c7
Merge remote-tracking branch 'upstream/main'
Roundabout1 May 15, 2024
10f9876
Merge branch 'main' of https://github.com/Roundabout1/lapki-client
Roundabout1 May 16, 2024
0c1b4d3
Merge remote-tracking branch 'upstream/main'
Roundabout1 May 21, 2024
2363581
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 3, 2024
fa46c7e
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 4, 2024
4055802
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 10, 2024
2cbebc7
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 17, 2024
5731cf7
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 17, 2024
e64e302
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jun 26, 2024
cfdfbb6
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jul 2, 2024
14a27f5
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jul 4, 2024
230509a
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jul 5, 2024
e4c6bb9
Merge remote-tracking branch 'upstream/main'
Roundabout1 Jul 15, 2024
67f1a49
Merge remote-tracking branch 'upstream/main'
Roundabout1 Aug 8, 2024
6299009
изменение цвета перехода начального состояния
Roundabout1 Aug 9, 2024
b1182a5
удаление лишнего кода из старых наработок
Roundabout1 Aug 9, 2024
dd91246
проверка на начальное состояние через useState
Roundabout1 Aug 12, 2024
18428ce
Merge remote-tracking branch 'upstream/main' into initial_arrow_color
Roundabout1 Aug 13, 2024
fbee9c2
Merge remote-tracking branch 'upstream/main'
Roundabout1 Aug 13, 2024
b9cba40
Merge branch 'main' into initial_arrow_color
Roundabout1 Aug 13, 2024
713142d
Merge remote-tracking branch 'upstream/main' into initial_arrow_color
Roundabout1 Aug 13, 2024
dec4928
Merge remote-tracking branch 'upstream/main' into initial_arrow_color
Roundabout1 Aug 14, 2024
0f25e44
add dColor to scheme
L140-beep Aug 14, 2024
472c777
Merge pull request #2 from L140-beep/add-initial-color
Roundabout1 Aug 14, 2024
7cac10c
Merge remote-tracking branch 'upstream/main' into initial_arrow_color
Roundabout1 Aug 14, 2024
27ae627
обновление библиотеки cyberiadaml-js
Roundabout1 Aug 14, 2024
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
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@electron-toolkit/utils": "^1.0.2",
"@floating-ui/react": "^0.26.9",
"@floating-ui/react-dom": "^2.0.8",
"@kruzhok-team/cyberiadaml-js": "^1.1.0",
"@kruzhok-team/cyberiadaml-js": "^1.1.3",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-switch": "^1.0.3",
"@tweenjs/tween.js": "^23.1.1",
Expand Down
22 changes: 19 additions & 3 deletions src/renderer/src/components/NodeModal/TransitionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TransitionModal: React.FC = () => {
source: State | ChoiceState;
target: State | ChoiceState | FinalState;
} | null>();
const [isInitialTransition, setIsInitialTransition] = useState<boolean>(false);

// Данные формы
const trigger = useTrigger(false);
Expand All @@ -41,6 +42,18 @@ export const TransitionModal: React.FC = () => {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();

if (isInitialTransition && transition) {
editor.controller.transitions.changeTransition({
id: transition.id,
sourceId: transition.source.id,
targetId: transition.target.id,
color,
});

close();
return;
}

const { selectedComponent, selectedMethod } = trigger;

if (showTrigger && (!selectedComponent || !selectedMethod)) {
Expand Down Expand Up @@ -153,6 +166,7 @@ export const TransitionModal: React.FC = () => {

setTransition(null);
setNewTransition(null);
setIsInitialTransition(false);
};

useEffect(() => {
Expand Down Expand Up @@ -182,6 +196,8 @@ export const TransitionModal: React.FC = () => {
setColor(initialData.color);

setTransition(target);

setIsInitialTransition(initialData.label == undefined);
open();
};

Expand All @@ -205,9 +221,9 @@ export const TransitionModal: React.FC = () => {
onAfterClose={handleAfterClose}
>
<div className="flex flex-col gap-4">
{showTrigger && <Trigger {...trigger} />}
<Condition {...condition} />
<Events {...events} />
{!isInitialTransition && showTrigger && <Trigger {...trigger} />}
{!isInitialTransition && <Condition {...condition} />}
{!isInitialTransition && <Events {...events} />}
Comment on lines +225 to +226
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO: здесь ограничение по isInitialTransition уйдёт, т.к. переход от начального состояния может иметь и то, и другое.

<ColorField label="Цвет линии:" value={color} onChange={setColor} />
</div>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ export class TransitionsController extends EventEmitter<TransitionsControllerEve
};

handleConditionDoubleClick = (transition: Transition) => {
if (!transition.data.label) return;
this.emit('changeTransition', transition);
};

Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/lib/data/GraphmlBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ function serializeNotes(notes: { [id: string]: Note }): { [id: string]: CGMLNote
text: note.text,
position: note.position,
type: 'informal',
unsupportedDataNodes: [],
};
}
return cgmlNotes;
Expand All @@ -313,6 +314,7 @@ function serializeComponents(components: { [id: string]: Component }): {
type: component.type,
parameters: component.parameters,
order: component.order,
unsupportedDataNodes: [],
};
}
return cgmlComponents;
Expand Down
Loading