const num_storage_slots = 16;
const skip_factor = 0.5;
-let num_regions = 1;
+let wf_nregions = 1;
let global_dict = new Object();
let active_region, was_clicked = null;
let global_dur = 3.0;
function region_add_specified(tstart, tend, ttext, id, tcolor) {
- num_regions++;
+ wf_nregions++;
wsr.addRegion({
channelIdx: id,
}
+//this was updated to the new system
function region_add_1(lane_id) {
if(lane_id > 2 | lane_id < 0){
}
const gen = gen_region_startend();
- //let nreg = wsr_lanes[2][lane_id];
- console.log("lane id: ", lane_id);
- console.log("wsr value: ", wsr_lanes[2][lane_id]);
- wsr_lanes[1][lane_id].addRegion({
- channelIdx: wsr_lanes[2][lane_id],
- content: "lane: " + lane_id + "inc: " + wsr_lanes[2][lane_id],
- id: 'region',
- start: gen[0],
- end: gen[1],
- loop: false,
- color: 'hsla(184, 32%, 72%, 0.1)'
+ if (lane_id == 0) {
+
+ console.log("wsr value: ", wf_nregions);
+ wsr.addRegion({
+ channelIdx: wf_nregions,
+ content: "wsr inc: " + (wf_nregions - 1),
+ id: 'region',
+ start: gen[0],
+ end: gen[1],
+ loop: false,
+ color: 'hsla(184, 32%, 72%, 0.1)'
});
- //increment the lane region counter
- wsr_lanes[2][lane_id]++;
+ wf_nregions++;
+
+ } else {
+
+ const nregions = wsr_lanes[2][lane_id];
+ console.log("lane id: ", lane_id);
+ console.log("wsr value: ", nregions);
+
+ wsr_lanes[1][lane_id].addRegion({
+ channelIdx: nregions,
+ content: "lane: " + lane_id + "inc: " + (nregions - 1),
+ id: 'region',
+ start: gen[0],
+ end: gen[1],
+ loop: false,
+ color: 'hsla(184, 32%, 72%, 0.1)'
+ });
+ //increment the lane region counter
+ wsr_lanes[2][lane_id]++;
+
+ }
}
function gen_color() {
for(let i = 1; i < 4; i++) {
const gen = gen_region_startend();
- num_regions++;
+ wf_nregions++;
//percent_hue = Math.floor(Math.random() * 100.0);
- //console.log("adding a region with id", num_regions);
+ //console.log("adding a region with id", wf_nregions);
wsr.addRegion({
- channelIdx: num_regions,
- content: "region" + (num_regions - 1) + "text",
+ channelIdx: wf_nregions,
+ content: "region" + (wf_nregions - 1) + "text",
id: 'region',
start: gen[0],
end: gen[1],
}
function region_add_at_time(time){
- num_regions++;
+ wf_nregions++;
//const percent_lum = Math.random() * 100.0;
let percent_hue = Math.floor(Math.random() * 100.0);
const color_str = 'hsla(' + percent_hue + ', 100%, 50%, 0.1)';
- //console.log("adding a region with id", num_regions);
+ //console.log("adding a region with id", wf_nregions);
wsr.addRegion({
- channelIdx: num_regions,
- content: "region " + (num_regions - 1) + " text",
+ channelIdx: wf_nregions,
+ content: "region " + (wf_nregions - 1) + " text",
//id: "cue " + i,
id: 'region',
start: time,
//add a region via a lane
function region_add_in_lane(id, time){
- num_regions++;
+ wf_nregions++;
let percent_hue = Math.floor(Math.random() * 100.0);
const color_str = 'hsla(' + percent_hue + ', 100%, 50%, 0.1)';
//2nd index is region instance
wsr_lanes[1][id].addRegion({
- channelIdx: num_regions,
- content: "region" + (num_regions - 1) + "text",
+ channelIdx: wf_nregions,
+ content: "region" + (wf_nregions - 1) + "text",
id: 'region',
start: time,
end: time + global_dur,
function clear_regions() {
wsr.clearRegions();
- num_regions = 1;
+ wf_nregions = 1;
for(let i = 0; i < wsr_lanes[0].length; i++){
wsr_lanes[1][i].clearRegions();
console.log("ls restore: reading localStorage...");
let inc = 0;
- clear_regions(); //sets num_regions to 1
+ clear_regions(); //sets wf_nregions to 1
for(var key in localStorage) {
let data = localStorage.getItem(key);
inc++;
}
- num_regions = inc;
+ wf_nregions = inc;
}
//-------------------------------------------------------------
call_action: function () {
active_region.remove();
active_region = null;
- num_regions--;
- console.log('num_regions is now:', num_regions);
+ wf_nregions--;
+ console.log('wf_nregions is now:', wf_nregions);
},
},