Example #1
0
void WWaveformViewer::wheelEvent(QWheelEvent *event) {
    if (m_waveformWidget) {
        //NOTE: (vrince) to limit the zoom action area uncomment the following line
        //if (event->x() > width() - m_zoomZoneWidth) {
            if (event->delta() > 0) {
                //qDebug() << "WaveformWidgetRenderer::wheelEvent +1";
                onZoomChange(m_waveformWidget->getZoomFactor()+1);
            }
            else {
                //qDebug() << "WaveformWidgetRenderer::wheelEvent -1";
                onZoomChange(m_waveformWidget->getZoomFactor()-1);
            }
        //}
    }
}
Example #2
0
bool UIMinimap::setZoom(int zoom)
{
    if(zoom == m_zoom)
        return true;

    if(zoom < m_minZoom || zoom > m_maxZoom)
        return false;

    int oldZoom = m_zoom;
    m_zoom = zoom;
    if(m_zoom < 0)
        m_scale = 1.0f / (1 << std::abs(zoom));
    else if(m_zoom > 0)
        m_scale = 1.0f * (1 << std::abs(zoom));
    else
        m_scale = 1;
    m_layout->update();
    
    onZoomChange(zoom, oldZoom);
    return true;
}