Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX check if shapes exist before setting the labels in the WebGL viewer #501

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cortex/svgoverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ def gen_path(path):
verts, codes = [], []
mode, pen = None, np.array([0.,0.])

it = iter(path.get('d').split(' '))
it = iter(path.get('d').strip().split(' '))
run = True
while run:
try:
Expand Down
9 changes: 6 additions & 3 deletions cortex/webgl/resources/js/svgoverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,12 @@ var svgoverlay = (function(module) {
}

var shapes = layer.parentNode.getElementById(this.name+"_shapes");
for (var i = 0 ; i < shapes.children.length; i++) {
var name = shapes.children[i].getAttribute("inkscape:label");
this.shapes[name] = shapes.children[i];
// check if shapes is not null
if (shapes != null) {
for (var i = 0 ; i < shapes.children.length; i++) {
var name = shapes.children[i].getAttribute("inkscape:label");
this.shapes[name] = shapes.children[i];
}
}

var labels = layer.parentNode.getElementById(this.name+"_labels");
Expand Down
Loading