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

chore: model editor and math view style tweaks #1007

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ $petri-inputBox: var(--gray-300);
--surface-b: #fafafa;
--surface-border: #D0D5DD;
--surface-border-light: #EAEAEA;
--surface-border-warning: #D92D20;
--surface-c: rgba(0, 0, 0, .04);
--surface-card: #ffffff;
--surface-d: rgba(0, 0, 0, .12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Button
@click="toggleEditEquation"
:label="isEditingEq ? 'Save equation' : 'Edit equation'"
class="p-button-sm p-button-outlined edit-button"
:class="isEditingEq ? 'p-button-sm' : 'p-button-sm p-button-outlined edit-button'"
/>
</span>
</section>
Expand Down Expand Up @@ -174,7 +174,7 @@ const cancelEditEquation = () => {

<style scoped>
math-field {
background-color: var(--gray-100);
background-color: var(--gray-0);
border-radius: 4px;
border: none;
outline: none;
Expand Down
45 changes: 29 additions & 16 deletions packages/client/hmi-client/src/components/models/Model.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,42 @@
<template #start>
<Button
@click="resetZoom"
label="Reset Zoom"
class="p-button-sm p-button-secondary"
label="Reset zoom"
class="p-button-sm p-button-outlined toolbar-button"
/>
</template>
<template #center>
<span class="p-buttonset">
<span class="toolbar-subgroup">
<Button
v-if="isEditing"
@click="addState"
label="Add State"
class="p-button-sm p-button-secondary"
label="Add state"
class="p-button-sm p-button-outlined toolbar-button"
/>
<Button
v-if="isEditing"
@click="addTransition"
label="Add Transition"
class="p-button-sm p-button-secondary"
label="Add transition"
class="p-button-sm p-button-outlined toolbar-button"
/>
</span>
</template>
<template #end>
<span class="p-buttonset">
<span class="toolbar-subgroup">
<Button
v-if="isEditing"
@click="cancelEdit"
label="Cancel"
class="p-button-sm p-button-secondary"
class="p-button-sm p-button-outlined toolbar-button"
/>
<Button
@click="toggleEditMode"
:label="isEditing ? 'Save model' : 'Edit model'"
class="p-button-sm p-button-secondary"
:class="
isEditing
? 'p-button-sm toolbar-button-saveModel'
: 'p-button-sm p-button-outlined toolbar-button'
"
/>
</span>
</template>
Expand Down Expand Up @@ -855,12 +859,20 @@ const mathJaxEq = (eq) => {
z-index: 1;
isolation: isolate;
background: transparent;
padding: 0.25rem;
padding: 0.5rem;
}

.button-container {
.p-button.p-component.p-button-sm.p-button-outlined.toolbar-button {
background-color: var(--surface-0);
margin: 0.25rem;
}

.toolbar-button-saveModel {
margin: 0.25rem;
}

.toolbar-subgroup {
display: flex;
float: right;
}

.fixed-header {
Expand Down Expand Up @@ -905,16 +917,17 @@ section math-editor {
width: 100%;
height: 100%;
flex-direction: column;
border-width: 2px;
border: 4px solid transparent;
border-radius: 0px var(--border-radius) var(--border-radius) 0px;
overflow: auto;
}

.math-editor-selected {
outline: 2px solid var(--primary-color);
border: 4px solid var(--primary-color);
}

.math-editor-error {
outline: 2px solid red;
border: 4px solid var(--surface-border-warning);
transition: outline 0.3s ease-in-out, color 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class PetrinetRenderer extends BasicRenderer<NodeData, EdgeData> {
super.initialize(element);

d3.select(this.svgEl)
.style('border', '2px solid transparent')
.style('border-radius', '8px 0px 0px 8px');
.style('border', '4px solid transparent')
.style('border-radius', 'var(--border-radius) 0px 0px var(--border-radius)');
}

setupDefs() {
Expand Down Expand Up @@ -66,9 +66,9 @@ export class PetrinetRenderer extends BasicRenderer<NodeData, EdgeData> {

const svg = d3.select(this.svgEl);
if (this.editMode) {
svg.style('border', '2px solid var(--primary-color)');
svg.style('border', '4px solid var(--primary-color)');
} else {
svg.style('border', '2px solid transparent');
svg.style('border', '4px solid transparent');
}
}

Expand Down