def mouseReleaseEvent(self, event):
        if not self.scene:
            return
        if self.event_sel:
            return
        if self.deselect:
            self.deselect = False
            return
        if not self.ready:
            return
        chk_marker = self.parent.notes.action['new_bookmark'].isChecked()
        chk_event = self.parent.notes.action['new_event'].isChecked()
        y_distance = self.parent.value('y_distance')
        if chk_marker or chk_event:
            x_in_scene = self.mapToScene(event.pos()).x()
            y_in_scene = self.mapToScene(event.pos()).y()
            if self.sel_xy[0] is not None:
                s_freq = self.parent.info.dataset.header['s_freq']
                at_s_freq = lambda x: round(x * s_freq) / s_freq
                start = at_s_freq(self.sel_xy[0])
                end = at_s_freq(x_in_scene)
                if abs(end - start) < self.parent.value('min_marker_dur'):
                    end = start
                if start <= end:
                    time = (start, end)
                else:
                    time = (end, start)
                if chk_marker:
                    self.parent.notes.add_bookmark(time)
                elif chk_event and start != end:
                    eventtype = self.parent.notes.idx_eventtype.currentText()
                    if abs(y_in_scene - self.sel_xy[1]) > 1.5 * y_distance:
                        chan = ''
                    else:
                        chan_idx = int(floor(self.sel_xy[1] / y_distance))
                        chan = self.chan[chan_idx]
                    self.parent.notes.add_event(eventtype, time, chan)
        else:
            if self.idx_info in self.scene.items():
                self.scene.removeItem(self.idx_info)
            self.idx_info = None
            self.parent.spectrum.update()
            self.parent.spectrum.display_window()
        self.sel_chan = None
        self.sel_xy = (None, None)
        if self.idx_sel in self.scene.items():
            self.scene.removeItem(self.idx_sel)
            self.idx_sel = None