Skip to content

Commit 2a17a66

Browse files
committed
Throttle some unnecessary update messages.
1 parent 1bd79c5 commit 2a17a66

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

js/SaverLoader.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class SaverLoader {
8686
}
8787

8888
updateSessions() {
89-
console.log("saverLoader.updateSessions()!");
9089
$('#sessionMenu').empty();
9190
let active_sessions = graph.active_sessions;
9291
if (active_sessions.length > 0) {

js/ViewManager.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,29 +181,36 @@ class ViewManager
181181
remove_object_svg(obj, 0);
182182
return;
183183
}
184+
if (event == 'removed') {
185+
// check here if tooltip is visible and has same key as the removed object
186+
if (self.tooltip.is_visible && self.tooltip.key == obj.key)
187+
self.tooltip.hide();
188+
}
189+
184190
switch (type) {
185191
case 'device':
186-
self._update_devices(obj, event, repaint);
192+
// only graph view might use device properties
193+
if (event != 'modified' || this.currentView == 'graph')
194+
self._update_devices(obj, event, repaint);
187195
break;
188196
case 'link':
189-
self._update_links(obj, event, repaint);
197+
if (event != 'modified' && this.currentView == 'chord')
198+
self._update_links(obj, event, repaint);
190199
break;
191200
case 'signal':
192-
self._update_signals(obj, event, repaint);
201+
// only graph view might use signal properties
202+
if (this.currentView == 'chord' || this.currentView == 'console')
203+
break;
204+
if (event != 'modified' || this.currentView == 'graph')
205+
self._update_signals(obj, event, repaint);
193206
break;
194207
case 'map':
195208
self._update_maps(obj, event, repaint);
196209
break;
197210
case 'session':
198-
console.log("got graph sessions callback!");
199211
self._update_sessions();
200212
break;
201213
}
202-
if (event == 'removed') {
203-
// check here if tooltip is visible and has same key as the removed object
204-
if (self.tooltip.is_visible && self.tooltip.key == obj.key)
205-
self.tooltip.hide();
206-
}
207214
});
208215
};
209216

@@ -270,7 +277,6 @@ class ViewManager
270277
}
271278

272279
_update_sessions() {
273-
console.log("ViewManager._update_sessions()");
274280
$('#container').trigger("updateSessions");
275281
}
276282

js/views/ChordView.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ class ChordView extends View {
4747
// remove associated svg elements for maps
4848
this.graph.maps.forEach(function(map) { remove_object_svg(map); });
4949

50-
this.devCount = this.canvas.text(this.mapPane.cx, this.mapPane.cy, " ")
51-
.attr({'font-size': 100,
52-
'opacity': 0.25,
53-
'fill': 'white',
54-
'x': this.mapPane.cx,
55-
'y': this.mapPane.cy});
56-
this.devCount.node.setAttribute('pointer-events', 'none');
57-
5850
this.updateDevices();
5951
this.resize();
6052
}
@@ -68,9 +60,6 @@ class ChordView extends View {
6860
this.mapPane.cy = this.frame.height * 0.5;
6961

7062
this.radius = Math.min(this.frame.width, this.frame.height) * 0.25;
71-
72-
this.devCount.attr({'x': this.mapPane.cx,
73-
'y': this.mapPane.cy});
7463
}
7564

7665
gap(numDevs) {
@@ -605,10 +594,6 @@ class ChordView extends View {
605594
let updated = false;
606595
if (elements.indexOf('devices') >= 0) {
607596
this.updateDevices();
608-
if (this.onlineDevs)
609-
this.devCount.attr({'text': ''});
610-
else
611-
this.devCount.attr({'text': 'waiting for devices'});
612597
updated = true;
613598
}
614599
if (elements.indexOf('links') >= 0) {
@@ -628,8 +613,6 @@ class ChordView extends View {
628613
super.cleanup();
629614

630615
// clean up any objects created only for this view
631-
if (this.devCount)
632-
this.devCount.remove();
633616
graph.links.forEach(function(link) {
634617
if (!link.view)
635618
return;
@@ -642,6 +625,10 @@ class ChordView extends View {
642625
dev.view.stick.remove();
643626
dev.view.stick = null;
644627
}
628+
if (dev.view.label) {
629+
dev.view.label.remove();
630+
dev.view.label = null;
631+
}
645632
dev.view.unclick();
646633
dev.view.unhover();
647634
});

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
netifaces==0.11.0
2-
libmapper==2.4.6
2+
libmapper==2.4.11
33
mappersession==0.0.15

0 commit comments

Comments
 (0)