Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _initSomething: function(object, signal, interval) {
- let sourceId = null;
- let signalId = object.connect(signal, (function() {
- if (sourceId)
- Mainloop.source_remove(sourceId);
- else
- this.hideBubble();
- sourceId = Mainloop.timeout_add(interval, (function() {
- this.showBubble();
- sourceId = null;
- }).bind(this));
- }).bind(this));
- Utils.once(this.bubble, 'closed', (function() {
- if (!sourceId)
- object.disconnect(signalId);
- }).bind(this));
- Utils.once(this, 'notify::selected', (function() {
- if (sourceId) {
- Mainloop.source_remove(sourceId);
- object.disconnect(signalId);
- }
- }).bind(this));
- },
- _initBubbleSignals: function() {
- // This is done to get just one marker selected at any time regardless
- // of the layer to which it belongs so we can get only one visible bubble
- // at any time. We do this for markers in different layers because for
- // markers in the same layer, ChamplainMarkerLayer single selection mode
- // does the job.
- this._mapView.onSetMarkerSelected(this);
- let markerSelectedSignalId = this._mapView.connect('marker-selected', (function(mapView, selectedMarker) {
- if (this.get_parent() != selectedMarker.get_parent())
- this.selected = false;
- }).bind(this));
- this._initSomething(this._view, 'notify::zoom-level', 500);
- this._initSomething(this._view, 'notify::size', 0);
- let buttonPressSignalId = this._view.connect('button-press-event',
- this.set_selected.bind(this, false));
- let goingToSignalId = this._mapView.connect('going-to',
- this.set_selected.bind(this, false));
- let parentSetSignalId = this.connect('parent-set',
- this.set_selected.bind(this, false));
- let dragMotionSignalId = this.connect('drag-motion',
- this.set_selected.bind(this, false));
- Utils.once(this.bubble, 'closed', (function() {
- this._mapView.disconnect(markerSelectedSignalId);
- this._view.disconnect(buttonPressSignalId);
- this._mapView.disconnect(goingToSignalId);
- this.disconnect(parentSetSignalId);
- this.disconnect(dragMotionSignalId);
- this._bubble.destroy();
- delete this._bubble;
- }).bind(this));
- },
Advertisement
Add Comment
Please, Sign In to add comment