Skip to content
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
6 changes: 3 additions & 3 deletions bun.lock

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "git+https://github.com/opencor/webapp.git"
},
"type": "module",
"version": "1.20261130.0",
"version": "1.20261130.1",
"engines": {
"bun": ">=1.2.0"
},
Expand Down Expand Up @@ -90,7 +90,7 @@
"stylelint-config-standard": "^41.1.0",
"tailwindcss": "^4.3.5",
"tailwindcss-primeui": "^0.6.1",
"tar": "^8.0.2",
"tar": "^8.0.3",
"typescript": "^7.0.2",
"typescript-6": "npm:typescript@^6.0.3",
"unplugin-vue-components": "^32.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/bun.lock

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

18 changes: 18 additions & 0 deletions src/renderer/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
[
{
"version": "1.20261130.1",
"changes": [
{
"type": "improved",
"description": "Splitters are now thicker, only show their grip while the mouse is moved, and get highlighted when hovered or dragged."
}
]
},
{
"version": "1.20261130.0",
"changes": [
{
"type": "added",
"description": "OpenCOR's Web app can now be installed (e.g., on a desktop, a tablet, or a phone) and used offline."
}
]
},
{
"version": "1.20261127.1",
"changes": [
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"./style.css": "./dist/opencor.css"
},
"version": "1.20261130.0",
"version": "1.20261130.1",
"libopencorVersion": "1.20261125.0",
"scripts": {
"build": "vite build && bun scripts/generate.version.ts",
Expand Down Expand Up @@ -89,7 +89,7 @@
"stylelint-config-standard": "^41.1.0",
"tailwindcss": "^4.3.5",
"tailwindcss-primeui": "^0.6.1",
"tar": "^8.0.2",
"tar": "^8.0.3",
"typescript": "^7.0.2",
"typescript-6": "npm:typescript@^6.0.3",
"unplugin-vue-components": "^32.1.0",
Expand Down
50 changes: 50 additions & 0 deletions src/renderer/src/common/vueCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,56 @@ export const useSidePanelSplitter = (
return { sizes, onResizeEnd };
};

// A composable to show the grips of the splitters within the given element while the mouse is being moved over that
// element (and for a short while after it has stopped moving), so that the splitters can be found without their grips
// always being shown (see simulation-experiment-view.css).
// Note #1: we only add/remove a class to/from the given element, and our grips fade in/out using CSS transitions.
// Note #2: the mouse may be moved a lot, so rather than restart a timer for each move, we keep track of when the mouse
// was last moved and, once our timer is up, we only hide our grips if the mouse hasn't been moved since.

const SPLITTER_GRIPS_LIFE = 2000;

export const useSplitterGrips = (elementRef: vue.Ref<HTMLElement | null>): void => {
const visibleClass = 'splitter-grips-visible';
let lastMoveTime = 0;
let timer: number | undefined;

const hideGrips = (): void => {
window.clearTimeout(timer);

timer = undefined;

elementRef.value?.classList.remove(visibleClass);
};

const checkGrips = (): void => {
const remainingTime = lastMoveTime + SPLITTER_GRIPS_LIFE - performance.now();

if (remainingTime > 0) {
timer = window.setTimeout(checkGrips, remainingTime);
} else {
hideGrips();
}
};

const showGrips = (): void => {
lastMoveTime = performance.now();

if (timer === undefined) {
elementRef.value?.classList.add(visibleClass);

timer = window.setTimeout(checkGrips, SPLITTER_GRIPS_LIFE);
}
};

vueusecore.useEventListener(elementRef, ['pointermove', 'pointerdown'], showGrips, { passive: true });
vueusecore.useEventListener(elementRef, 'pointerleave', hideGrips, { passive: true });

vue.onBeforeUnmount(() => {
window.clearTimeout(timer);
});
};

// A constant to know the UID of the active instance of OpenCOR.

export const activeInstanceUid = vueusecore.createGlobalState(() => vue.ref<string | null>(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ const model = isDocumentValid ? document.model(0) : null;
const narrowLayout = vueCommon.useNarrowLayout(rootRef);
const { sizes: sidePanelSizes, onResizeEnd: onSidePanelResizeEnd } = vueCommon.useSidePanelSplitter(narrowLayout);

vueCommon.useSplitterGrips(rootRef);

// Some helper functions to evaluate and apply the model changes resulting from the given parameters and scope.

interface ModelChange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ const simulationStatus = vue.ref<locSedApi.SedInstanceStatus>(instance?.status()
const narrowLayout = vueCommon.useNarrowLayout(rootRef);
const { sizes: sidePanelSizes, onResizeEnd: onSidePanelResizeEnd } = vueCommon.useSidePanelSplitter(narrowLayout);

vueCommon.useSplitterGrips(rootRef);

// The outcome of our last simulation run, if any, and the status of our simulation, which we show in our toolbar.

interface LastRun {
Expand Down
92 changes: 58 additions & 34 deletions src/renderer/src/components/views/simulation-experiment-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,82 +97,106 @@

/**
* Splitters (i.e. between our side panel and our plots and, in the Standard view, our console), which gutters are
* shown as thin lines with a grip (i.e. their handle) in their middle, so that they can be told apart from plain
* lines, and which get highlighted when hovered, dragged, or focused.
* shown as thick lines (as thick as their grip). Their grip (i.e. their handle, three dots in their middle) is only
* shown while the mouse is being moved over our view (see useSplitterGrips()), and fades out once the mouse has
* stopped moving. A gutter gets highlighted (without its grip) when hovered (after a short delay, so that it doesn't
* flicker when the mouse merely passes over it) or dragged.
* Note: PrimeVue's Splitter sets the width (horizontal layout) or height (vertical layout) of a gutter handle inline
* (to its gutter size, i.e. 4px by default), so we use the same size for our gutter (which also means that the
* sizes of our panels, which PrimeVue computes using that gutter size, are right).
*/

.p-splitter-gutter {
position: relative;
background-color: var(--p-content-border-color);
transition: background-color 0.15s ease;
transition: background-color 0.15s ease-out;
}

.p-splitter-horizontal > .p-splitter-gutter {
width: 1px !important;
width: 4px !important;
}

.p-splitter-vertical > .p-splitter-gutter {
height: 1px !important;
height: 4px !important;
}

/**
* Note #1: our gutter handle is a grip, i.e. three dots in a gap of our gutter. Its dots are drawn using a repeated
* radial gradient (in its content box), and our gap using the background colour of our contents (in its
* padding box), which hides our gutter around our dots.
* Note #2: our dots are wider than our gutter (which is only 1px wide/high), so that they can be seen. They overflow
* our gutter on both sides (since our gutter centres our handle), which is why they are 3px wide/high (i.e.
* an odd number of pixels, so that they are centred on our gutter rather than straddle half pixels), and
* they are drawn above our panels (since our gutter has a z-index, see PrimeVue's Splitter).
* Note #3: PrimeVue's Splitter sets the width (horizontal layout) or height (vertical layout) of our handle inline
* (to its gutter size, i.e. 4px by default), hence we need !important to override it (as for our gutter).
* Note: our gutter handle is a grip, i.e. three small dots drawn using a repeated radial gradient, and centred on our
* gutter.
*/

.p-splitter-gutter-handle {
--grip-dot-color: var(--p-content-border-color);
--grip-dot-color: var(--p-text-muted-color);

flex-shrink: 0;
box-sizing: content-box;
border-radius: 0;
background:
radial-gradient(circle at 1.5px 1.5px, var(--grip-dot-color) 1.2px, transparent 1.6px) 0 0 / 3px 6px repeat-y
content-box,
var(--p-content-background);
opacity: 0;
transition: opacity 0.25s ease-in;
}

.p-splitter-horizontal > .p-splitter-gutter > .p-splitter-gutter-handle {
width: 3px !important;
width: 4px !important;
height: 15px;
padding: 4px 0;
background:
radial-gradient(circle at 2px 2.5px, var(--grip-dot-color) 0.8px, transparent 1.2px) 0 0 / 4px 5px repeat-y;
}

.p-splitter-vertical > .p-splitter-gutter > .p-splitter-gutter-handle {
width: 15px;
height: 3px !important;
padding: 0 4px;
background-size:
6px 3px,
auto;
background-repeat: repeat-x, no-repeat;
height: 4px !important;
background:
radial-gradient(circle at 2.5px 2px, var(--grip-dot-color) 0.8px, transparent 1.2px) 0 0 / 5px 4px repeat-x;
}

&.splitter-grips-visible .p-splitter-gutter > .p-splitter-gutter-handle {
opacity: 1;
transition-duration: 0.15s;
}

/**
* Note: a gutter is only 1px wide/high, so we make it easier to grab by extending its hit area.
* Note: a gutter is only 4px wide/high, so we make it easier to grab by extending its hit area.
*/

.p-splitter-gutter::after {
position: absolute;
inset: -3px;
inset: -2px;
z-index: 1;
content: "";
}

.p-splitter-gutter:hover,
.p-splitter-gutter[data-p-gutter-resizing="true"],
.p-splitter-gutter:hover {
background-color: var(--p-primary-color);
transition-delay: 0.3s;

& > .p-splitter-gutter-handle {
opacity: 0;
transition: opacity 0.1s ease-out 0.3s;
}
}

.p-splitter-gutter[data-p-gutter-resizing="true"] {
background-color: var(--p-primary-color);
transition: none;

& > .p-splitter-gutter-handle {
opacity: 0;
transition: none;
}
}

/**
* Show our grip, highlighted, when it has the keyboard focus, so that its focus ring can be seen (see app.css).
*/

.p-splitter-gutter:has(.p-splitter-gutter-handle:focus-visible) {
background-color: var(--p-primary-color);
transition: none;

& > .p-splitter-gutter-handle {
--grip-dot-color: var(--p-primary-contrast-color);

.p-splitter-gutter-handle {
--grip-dot-color: var(--p-primary-color);
opacity: 1;
transition: none;
}
}

Expand Down
Loading