File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -238,8 +238,11 @@ def show_heatmap(path,type = false)
238
238
heatmapInstance.addData(data_xpath);
239
239
var scroll = JSON.parse('#{ raw ( @scroll_data . to_json . html_safe ) } ');
240
240
var scroll_data = scroll.map(function(element){
241
- width = getElement(element.xpath).getBoundingClientRect().width;
242
- height = getElement(element.xpath).getBoundingClientRect().height;
241
+ var element = getElement(element.xpath);
242
+ if (!element)
243
+ return;
244
+ width = element.getBoundingClientRect().width;
245
+ height = element.getBoundingClientRect().height;
243
246
dot = document.createElement('div');
244
247
dot.className = "dot";
245
248
dot.style.left = (getOffset(element.xpath).x+ (width * element.offset_x)) + "px";
@@ -261,6 +264,7 @@ def show_heatmap(path,type = false)
261
264
document.body.appendChild(dot);
262
265
});
263
266
267
+ scroll_data = scroll_data.filter(function(val){ return val!==undefined; });
264
268
</script>
265
269
JS
266
270
You can’t perform that action at this time.
0 commit comments