Skip to content

Commit 4423229

Browse files
authored
Compressed View ms labels and Compressed view highlight (#241)
* disable compressed overlay layer when in compressed view * add left/right indicators to times, disable legend times for compressed when compressed view zoomed out * replace ms with subscript ms
1 parent 0f00c7e commit 4423229

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

client/src/components/geoJS/LayerManager.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ export default defineComponent({
321321
if (viewCompressedOverlay.value && compressedOverlayLayer && !props.spectroInfo?.compressedWidth && props.spectroInfo?.start_times && props.spectroInfo.end_times) {
322322
compressedOverlayLayer.formatData(props.spectroInfo.start_times, props.spectroInfo.end_times, props.yScale);
323323
compressedOverlayLayer.redraw();
324+
} else {
325+
compressedOverlayLayer?.disable();
324326
}
325327
if (sequenceAnnotationLayer && layerVisibility.value.includes('sequence')) {
326328
sequenceAnnotationLayer.formatData(

client/src/components/geoJS/layers/legendLayer.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface TextData {
2020
textAlign?: 'left' | 'center' | 'right';
2121
textBaseline?: 'top' | 'middle' | 'bottom';
2222
textScaled?: number | undefined;
23+
compressedLabel?: boolean;
2324
}
2425

2526
export default class LegendLayer extends BaseTextLayer<TextData> {
@@ -153,7 +154,7 @@ export default class LegendLayer extends BaseTextLayer<TextData> {
153154
thicker: i % 1000 === 0,
154155
});
155156
this.textDataX.push({
156-
text: `${i}ms`,
157+
text: `${i}ₘₛ`,
157158
type: 'time',
158159
x: i * timeToPixels,
159160
y: baseYPos + length,
@@ -260,22 +261,26 @@ export default class LegendLayer extends BaseTextLayer<TextData> {
260261
//Need to decide what text to add to the label
261262
if (!bottomWithinYAxisStart) {
262263
this.textDataX.push({
263-
text: `${start_time}ms`,
264+
text: `${start_time}ₘₛ`,
264265
type: 'time',
265266
x: 0 + pixelOffset,
266267
y: baseYPos + length + (yOffset === 0 ? 18 : -12),
267268
textScaled: this.textScaled,
269+
textAlign: 'left',
270+
compressedLabel: true,
268271
});
269272
}
270273
if (!topWithinYAxisEnd) {
271274

272275
this.textDataX.push({
273-
text: `${end_time}ms`,
276+
text: `${end_time}ₘₛ◀`,
274277
type: 'time',
275278
x: width + pixelOffset,
276279
y: baseTopPos + (baseTopPos === 0 ? -16 : 16),
277280
textBaseline: baseTopPos === 0 ? 'bottom' : 'top',
281+
textAlign: 'right',
278282
textScaled: this.textScaled,
283+
compressedLabel: true,
279284
});
280285
}
281286
pixelOffset += width;
@@ -514,6 +519,7 @@ export default class LegendLayer extends BaseTextLayer<TextData> {
514519
textAlign: (data) => (data.textAlign || "center"),
515520
textScaled: (data) => (data.textScaled),
516521
fontSize: (data) => data.type === 'time' && this.compressedView ? `${this.getFontSize(16, 10, this.xScale)}px` : `20px`,
522+
visible: (data) => (data.compressedLabel && this.xScale < 1.5) ? false : true,
517523
};
518524
}
519525
}

client/src/components/geoJS/layers/timeLayer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ export default class TimeLayer extends BaseTextLayer<TextData> {
120120
});
121121
// Now we need to create the text Labels
122122
this.textData.push({
123-
text: `${start_time}ms`,
123+
text: `${start_time}ₘₛ`,
124124
x: xmin,
125125
y: ymin + lineDist + 5,
126126
textBaseline: 'top',
127127
});
128128
this.textData.push({
129-
text: `${end_time}ms`,
129+
text: `${end_time}ₘₛ`,
130130
x: xmax,
131131
y: ymin + lineDist + 5,
132132
textBaseline: 'top',
@@ -182,12 +182,12 @@ export default class TimeLayer extends BaseTextLayer<TextData> {
182182
});
183183
// Now we need to create the text Labels
184184
this.textData.push({
185-
text: `${start_time}ms`,
185+
text: `${start_time}ₘₛ`,
186186
x: xmin,
187187
y: ymax - lineDist,
188188
});
189189
this.textData.push({
190-
text: `${end_time}ms`,
190+
text: `${end_time}ₘₛ`,
191191
x: xmax,
192192
y: ymax - lineDist,
193193
});
@@ -225,7 +225,7 @@ export default class TimeLayer extends BaseTextLayer<TextData> {
225225
const ypos = (ymax + ymin) / 2.0;
226226
// Now we need to create the text Labels
227227
this.textData.push({
228-
text: `${end_time - start_time}ms`,
228+
text: `${end_time - start_time}ₘₛ`,
229229
x: xpos,
230230
y: ypos + lineDist,
231231
});
@@ -257,7 +257,7 @@ export default class TimeLayer extends BaseTextLayer<TextData> {
257257
const xpos = (xmin + xmax) / 2.0;
258258
// Now we need to create the text Labels
259259
this.textData.push({
260-
text: `${end_time - start_time}ms`,
260+
text: `${end_time - start_time}ₘₛ`,
261261
x: xpos,
262262
y: ((ymax - ymin) / 2.0) + -35 + offsetY,
263263
});

client/src/components/geoJS/layers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export interface LayerStyle<D> {
2121
textBaseline?: ((data: D) => string) | string;
2222
textScaled?: ((data: D) => number | undefined) | number | undefined;
2323
[x: string]: unknown;
24+
visible?: (data: D) => boolean;
2425
}

0 commit comments

Comments
 (0)