Changeset 3544:d65e82044cf0 in orange


Ignore:
Timestamp:
04/17/07 11:50:56 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
6c4379b76cea2db0081f4ad4128603b22db36bd1
Message:
  • smooth zooming fixed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGraph.py

    r3538 r3544  
    451451        return 0 
    452452 
    453     def setNewZoom(self, currXMin, currXMax, currYMin, currYMax, newXMin, newXMax, newYMin, newYMax): 
    454         zoomOutCurveKey = self.insertCurve(PolygonCurve(self, brush = None, xData = [currXMin, currXMax, currXMax, currXMin, currXMin], yData = [currYMin, currYMin, currYMax, currYMax, currYMin])) 
     453    def setNewZoom(self, oldXMin, oldXMax, oldYMin, oldYMax, newXMin, newXMax, newYMin, newYMax): 
     454        #zoomOutCurveKey = self.insertCurve(RectangleCurve(self, brush = None, xData = [oldXMin, oldXMax, oldXMax, oldXMin], yData = [oldYMin, oldYMin, oldYMax, oldYMax])) 
    455455        if len(self.curveKeys()) > 2000:    # if too many curves then don't be smooth 
    456456            steps = 1 
     
    458458            steps = 10 
    459459        for i in range(1, steps+1): 
    460             midXMin = currXMin * (steps-i)/float(steps) + newXMin * i/float(steps) 
    461             midXMax = currXMax * (steps-i)/float(steps) + newXMax * i/float(steps) 
    462             midYMin = currYMin * (steps-i)/float(steps) + newYMin * i/float(steps) 
    463             midYMax = currYMax * (steps-i)/float(steps) + newYMax * i/float(steps) 
     460            midXMin = oldXMin * (steps-i)/float(steps) + newXMin * i/float(steps) 
     461            midXMax = oldXMax * (steps-i)/float(steps) + newXMax * i/float(steps) 
     462            midYMin = oldYMin * (steps-i)/float(steps) + newYMin * i/float(steps) 
     463            midYMax = oldYMax * (steps-i)/float(steps) + newYMax * i/float(steps) 
     464            self.setAxisScale(QwtPlot.yLeft, midYMax, midYMin) 
    464465            self.setAxisScale(QwtPlot.xBottom, midXMin, midXMax) 
    465             self.setAxisScale(QwtPlot.yLeft, midYMin, midYMax) 
    466             if i == steps: 
    467                 self.removeCurve(zoomOutCurveKey) 
     466 
     467            #if i == steps: 
     468            #    self.removeCurve(zoomOutCurveKey) 
    468469            self.replot() 
    469470 
     
    567568                self.blankClick = 0 
    568569                self.zoomStack.append((self.axisScale(QwtPlot.xBottom).lBound(), self.axisScale(QwtPlot.xBottom).hBound(), self.axisScale(QwtPlot.yLeft).lBound(), self.axisScale(QwtPlot.yLeft).hBound())) 
    569                 self.setNewZoom(self.axisScale(QwtPlot.xBottom).lBound(), self.axisScale(QwtPlot.xBottom).hBound(), self.axisScale(QwtPlot.yLeft).lBound(), self.axisScale(QwtPlot.yLeft).hBound(), xmin, xmax, ymin, ymax) 
     570                self.setNewZoom(self.axisScale(QwtPlot.xBottom).lBound(), self.axisScale(QwtPlot.xBottom).hBound(), self.axisScale(QwtPlot.yLeft).lBound(), self.axisScale(QwtPlot.yLeft).hBound(), xmin, xmax, ymax, ymin) 
    570571 
    571572            elif self.state == SELECT_RECTANGLE: 
     
    680681            colorB = self._getColorFromObject(c.brush()) 
    681682            linewidth = c.pen().width() 
    682             if c.__class__ == PolygonCurve: 
     683            if c.__class__ == PolygonCurve or c.__class__ == RectangleCurve: 
    683684                x0 = min(xData); x1 = max(xData); diffX = x1-x0 
    684685                y0 = min(yData); y1 = max(yData); diffY = y1-y0 
Note: See TracChangeset for help on using the changeset viewer.