Skip to content

Commit 5ed6db9

Browse files
committed
[Frontend] minor updates
1 parent 3d6f1ec commit 5ed6db9

File tree

11 files changed

+213
-264
lines changed

11 files changed

+213
-264
lines changed

notes.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Improvement ideas
22
## Editor
3-
- [ ] Bug testing (I can't recall the issues we had previously)
43
- [ ] Possibly: Resize listener on canvas container
5-
- [ ] **Move advanced options into a popover instead of the sidebar**
6-
- [ ] **Autosave -- TODO: Add button to disable (`src/editor/index.ts` exports the option to do so)**
7-
- [ ] **Legend displaying what the colours mean**
4+
- [X] Move advanced options into a popover instead of the sidebar -> default collapsed, expanded
5+
- [X] Autosave
6+
- [X] Legend displaying what the colours mean
87
- [X] Fix animation for sidebar collapse
98
- [X] Heatmap i.e. points are coloured based on the entropy
109
- [X] Loading of disagreement metrics from backend
@@ -20,7 +19,6 @@
2019
- [X] Keybind to flag as invalid
2120
- [X] Shift to show all algorithms for current fixation
2221
- [X] Use other combination for the above, as shift key cannot be detected (neither all other modifiers)
23-
- [ ] **Do we need more settings for the above?**
2422
- [X] Fixation click on fixation in box directly assigning it
2523
- [X] Test the above, may need to be changed to a more complex handler
2624
- [X] Filter annotations by algorithms
@@ -31,12 +29,12 @@
3129

3230
## General
3331
- [X] Deployment
34-
- [ ] **Update theme colours (currently primarily the blue and black themes look good)**
32+
- [X] Update theme colours
3533
- [X] Better error handling for backend errors (i.e. better notifications)
3634
- [ ] **RWD fixes (Signup and Login views)**
3735
- [X] Block if device is too small (also touch devices don't work!) -> Design?
3836
- [ ] Take care of all TODOs in the code
39-
- [ ] **Buttons with long actions need spinners or other progress indicator** (I can also do that)
37+
- [ ] **Buttons with long actions need spinners or other progress indicator** (I can also do that) (then do it?)
4038

4139

4240

@@ -52,7 +50,7 @@
5250
- [ ] Pre-annotations: One file for each algorithm, filename is the algo name (minus extension).
5351
- [ ] **Define file contents specs somewhere** -> Needs integration & design, see `src/components/admin/FileSpecs.vue`
5452
- [ ] Magic link regen
55-
- [ ] Magic link panel close warning
53+
- [X] Magic link panel close warning
5654
- [X] survey delete -- TODO: Testing
5755
- [X] survey export -- TODO: Testing
5856
- [X] on index errors open parser settings panel

src/editor/components/EditorView.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import {
44
type Ref, ref
55
} from 'vue';
6-
import PropertyPane from './PropertyPane.vue';
6+
import LegendPane from './LegendPane.vue';
77
import editor from '..';
88
import {
99
editorDataLoadingLocal
@@ -40,8 +40,8 @@
4040
Image: <input type="file" accept="image/*" @change="e => loader.loadImage( e as InputEvent )">
4141
Points: <input type="file" accept=".csv" @change="e => loader.loadPointsCSV( e as InputEvent )">
4242
</div>
43-
<PropertyPane
44-
:show-property-pane="true"
43+
<LegendPane
44+
:show="true"
4545
/>
4646
<div class="canvas-wrapper">
4747
<canvas id="text" ref="textCanvas"></canvas>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<script setup lang="ts">
2+
import {
3+
type Ref,
4+
ref
5+
} from 'vue';
6+
import type {
7+
EditorPoint
8+
} from '../types/annotation';
9+
import ColorOption from '@/components/settings/ColorOption.vue';
10+
import { assignedFixationColor, machineAssignedFixationColor, selectedFixationColor, unassignedFixationColor } from '../config';
11+
12+
const props = defineProps<{
13+
'show': boolean,
14+
}>();
15+
const isDragging = ref( false );
16+
const pos: Ref<EditorPoint> = ref( {
17+
'x': 10,
18+
'y': 10
19+
} );
20+
21+
let oldPos: EditorPoint = {
22+
'x': 0,
23+
'y': 0
24+
};
25+
26+
const clickPos: EditorPoint = {
27+
'x': 0,
28+
'y': 0
29+
};
30+
31+
const dragHandler = ( ev: MouseEvent ) => {
32+
if ( !isDragging.value && ev.buttons === 1 ) {
33+
isDragging.value = true;
34+
oldPos = {
35+
...pos.value
36+
};
37+
clickPos.x = ev.x;
38+
clickPos.y = ev.y;
39+
} else if ( isDragging.value ) {
40+
pos.value = {
41+
'x': oldPos.x + ( clickPos.x - ev.x ),
42+
'y': oldPos.y + ( clickPos.y - ev.y )
43+
};
44+
}
45+
};
46+
47+
const mouseUp = () => {
48+
isDragging.value = false;
49+
};
50+
</script>
51+
52+
<template>
53+
<div
54+
v-if="props.show"
55+
id="tour-properties"
56+
class="legend"
57+
:style="`bottom: ${ pos.y }px; right: ${ pos.x }px;`"
58+
@mousemove="dragHandler"
59+
@mouseup="mouseUp"
60+
>
61+
<h2>Legend</h2>
62+
<div class="placeholder">
63+
<p>Fixation Colors</p>
64+
<ColorOption v-model="selectedFixationColor" text="Selected" />
65+
<ColorOption v-model="assignedFixationColor" text="User-assigned" />
66+
<ColorOption v-model="machineAssignedFixationColor" text="Algorithm-assigned" />
67+
<ColorOption v-model="unassignedFixationColor" text="Unassigned" />
68+
</div>
69+
</div>
70+
</template>
71+
72+
<style scoped>
73+
74+
.legend {
75+
position: absolute;
76+
width: 15rem;
77+
height: 16rem;
78+
z-index: 1;
79+
box-shadow: 0px 0px 10px var(--theme-bg-1);
80+
81+
user-select: none;
82+
83+
>h2 {
84+
margin: 0px;
85+
padding-bottom: 1rem;
86+
}
87+
88+
>div {
89+
background-color: var(--theme-bg-1);
90+
padding: 10px;
91+
92+
>p {
93+
color: var(--theme-background-text-20);
94+
margin: 0px;
95+
padding-bottom: 1rem;
96+
}
97+
}
98+
99+
background-color: var(--theme-bg-2);
100+
padding: 1rem;
101+
border-radius: 10px;
102+
}
103+
</style>

src/editor/components/OptionsPane.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
linesDisplayOptions
1111
} from '../config';
1212
import SliderOptions from '@/components/settings/SliderOptions.vue';
13+
import SwitchOption from '@/components/settings/SwitchOption.vue';
14+
import { isAutoSaveEnabled } from '..';
1315
</script>
1416

1517
<template>
1618
<div class="options-pane">
1719
<div class="options-container">
1820
<div class="options-section">
19-
<p> Display </p>
2021
<SliderOptions
2122
v-model="boxesDisplay"
2223
:options="boxesDisplayOptions"
@@ -37,6 +38,7 @@
3738
:options="fixationIndexDisplayOptions"
3839
text="Fixation Index"
3940
/>
41+
<SwitchOption text="Autosave" v-model="isAutoSaveEnabled" />
4042
</div>
4143
</div>
4244
</div>
@@ -70,6 +72,7 @@
7072
justify-content: space-between;
7173
7274
.options-section {
75+
padding-top: 1rem;
7376
7477
.slider-option {
7578
width: 16rem;

src/editor/components/PreferencesPane.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
};
2626
2727
const show = defineModel<boolean>();
28-
// TODO: Think about which options should go where
2928
</script>
3029

3130
<template>
@@ -38,7 +37,7 @@
3837
<div>
3938
<div class="options-container">
4039
<div class="options-section">
41-
<p>Advanced</p>
40+
<p>Display</p>
4241
<SliderOptions
4342
v-model="boxesDisplay"
4443
:options="boxesDisplayOptions"
@@ -91,7 +90,7 @@
9190
</div>
9291

9392
<div class="options-section">
94-
<p>Further display</p>
93+
<p>Details</p>
9594

9695
<div class="slider-option">
9796
<p>Line width</p>

0 commit comments

Comments
 (0)