Skip to content
Merged
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
8 changes: 1 addition & 7 deletions cortex/webgl/resources/js/svgoverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,11 @@ var svgoverlay = (function(module) {
this.svg.setAttribute("height", this.height);
},
module.SVGOverlay.prototype.update = function() {
// Re-bake the SVG overlay into a GPU texture asynchronously (toDataURL -> Image.onload).
// Rapid layer toggles (ROIs / sulci / labels) can kick off several bakes that finish out
// of order, leaving a stale texture on the surface that disagrees with the switch state.
// Tag each bake with a generation id and commit only the most recent one.
var gen = (this._updateGen = (this._updateGen || 0) + 1);
console.log("Updating overlay!");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The console.log statement appears to be a leftover debug log. It is recommended to remove it to avoid cluttering the browser console in production environments.

this.svg.toDataURL("image/png", {renderer:"native", callback:function(dataurl) {
var img = new Image();
//img.src = dataurl;
img.onload = function () {
if (gen !== this._updateGen)
return; // superseded by a newer toggle -- discard this stale bake
var tex = new THREE.Texture(img);
tex.needsUpdate = true;
//tex.anisotropy = 16;
Expand Down