Skip to content

Commit

Permalink
Fixing issue with timeseries selected waveforms occluding unselected …
Browse files Browse the repository at this point in the history
…waveforms. Closes #1132
  • Loading branch information
alexsielicki committed Aug 2, 2023
1 parent 23f8a4f commit 1d96a46
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"layout-jquery3": "1.8.5",
"lodash": "4.17.21",
"papaparse": "^5",
"parse-css-color": "^0.2.1",
"react": "^18",
"react-dom": "^18",
"react-redux": "^8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// HTML5 DOM waveform visualization, for use with the timeseries model.

import d3 from "d3";
import parseCSSColor from "parse-css-color";
import knob from "jquery-knob";
import slycat_color_maps from "js/slycat-color-maps";

Expand Down Expand Up @@ -299,12 +300,13 @@ $.widget("timeseries.waveformplot", {
this.canvas_picker.width = this.diagram_width;
this.canvas_picker.height = this.diagram_height;

var fillStyle = slycat_color_maps.get_background(self.options.get_state().controls.colormap);
var opacity = slycat_color_maps.get_opacity(self.options.get_state().controls.colormap);
this.canvas_hover_ctx.fillStyle =
"rgba(" + fillStyle.r + ", " + fillStyle.g + ", " + fillStyle.b + ", " + opacity + ")";
this.canvas_selection_ctx.fillStyle =
"rgba(" + fillStyle.r + ", " + fillStyle.g + ", " + fillStyle.b + ", " + opacity + ")";
const [r, g, b] = parseCSSColor(
slycat_color_maps.get_background(self.options.get_state().controls.colormap)
).values;
const opacity = slycat_color_maps.get_opacity(self.options.get_state().controls.colormap);
const rgba = `rgba(${r}, ${g}, ${b}, ${opacity})`;
this.canvas_hover_ctx.fillStyle = rgba;
this.canvas_selection_ctx.fillStyle = rgba;

var waveform_subset = [];
if (visible !== undefined) {
Expand Down Expand Up @@ -426,7 +428,6 @@ $.widget("timeseries.waveformplot", {
/* Hover effect for waveforms */
_hover: function (waveforms) {
var self = this;
var fillStyle;

// Only hover a waveform if it's part of the current selection
var selection = self.options.selection;
Expand Down
4 changes: 2 additions & 2 deletions web-server/plugins/slycat-timeseries-model/js/timeseries.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export default function initialize_timeseries_model(
.toString(),
});
$("#waveform-viewer rect.selectionMask").css({
fill: slycat_color_maps.get_background(get_state().controls.colormap).toString(),
"fill": slycat_color_maps.get_background(get_state().controls.colormap),
"fill-opacity": slycat_color_maps.get_opacity(get_state().controls.colormap),
});

Expand Down Expand Up @@ -706,7 +706,7 @@ export default function initialize_timeseries_model(
.toString(),
});
$("#waveform-viewer rect.selectionMask").css({
fill: slycat_color_maps.get_background(get_state().controls.colormap).toString(),
"fill": slycat_color_maps.get_background(get_state().controls.colormap),
"fill-opacity": slycat_color_maps.get_opacity(get_state().controls.colormap),
});

Expand Down
4 changes: 2 additions & 2 deletions web-server/plugins/slycat-video-swarm/js/vs-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function model_loaded() {
.toString(),
});
$("#waveform-viewer rect.selectionMask").css({
fill: $("#color-switcher").colorswitcher("get_background", colormap).toString(),
"fill": $("#color-switcher").colorswitcher("get_background", colormap).toString(),
"fill-opacity": $("#color-switcher").colorswitcher("get_opacity", colormap),
});
$("#mp-movies").css({
Expand Down Expand Up @@ -754,7 +754,7 @@ function update_waveform_color() {
"background-color": $("#color-switcher").colorswitcher("get_background", undefined).toString(),
});
$("#waveform-viewer rect.selectionMask").css({
fill: $("#color-switcher").colorswitcher("get_background", undefined).toString(),
"fill": $("#color-switcher").colorswitcher("get_background", undefined).toString(),
"fill-opacity": $("#color-switcher").colorswitcher("get_opacity", undefined),
});

Expand Down

0 comments on commit 1d96a46

Please sign in to comment.