Changeset 4419


Ignore:
Timestamp:
May 14, 2020 8:25:30 PM (3 years ago)
Author:
toby
Message:

Allow plotting to show selected atoms; reorder some code to put internal functions at top; fix mac bug where drag even is called with less than one pxel in motion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4416 r4419  
    14341434        if not len(oldxy): oldxy = list(newxy)
    14351435        dxy = newxy-oldxy
     1436        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    14361437        drawingData['oldxy'] = list(newxy)
    14371438        V = np.array([dxy[1],dxy[0],0.])
     
    14571458        if not len(oldxy): oldxy = list(newxy)
    14581459        dxy = newxy-oldxy
     1460        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    14591461        drawingData['oldxy'] = list(newxy)
    14601462        V = drawingData['viewDir']
     
    79357937                Bonds[j].append(-Dx[j]/2.)
    79367938        return Bonds
    7937 
    7938     # PlotStructure initialization here
    7939     global mcsaXYZ,mcsaTypes,mcsaBonds,txID,contourSet,Zslice
    7940     global cell, Vol, Amat, Bmat, A4mat, B4mat
    7941     txID = 0
    7942     ForthirdPI = 4.0*math.pi/3.0
    7943     generalData = data['General']
    7944     cell = generalData['Cell'][1:7]
    7945     ABC = np.array(cell[0:3])
    7946     Vol = generalData['Cell'][7:8][0]
    7947     Amat,Bmat = G2lat.cell2AB(cell)         #Amat - crystal to cartesian, Bmat - inverse
    7948     Gmat,gmat = G2lat.cell2Gmat(cell)
    7949     A4mat = np.concatenate((np.concatenate((Amat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
    7950     B4mat = np.concatenate((np.concatenate((Bmat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
    7951     SGData = generalData['SGData']
    7952     SpnFlp = SGData.get('SpnFlp',[1,])
    7953     atomData = data['Atoms']
    7954     mapPeaks = []
    7955     contourSet = 0
    7956     if generalData.get('DisAglCtrls',{}):
    7957         BondRadii = generalData['DisAglCtrls']['BondRadii']
    7958     else:
    7959         BondRadii = generalData['BondRadii']
    7960     drawingData = data['Drawing']
    7961     if not drawingData:
    7962         return          #nothing setup, nothing to draw   
    7963     G2phG.SetDrawingDefaults(drawingData)
    7964     if 'Map Peaks' in data:
    7965         mapPeaks = np.array(data['Map Peaks'])
    7966         peakMax = 100.
    7967         if len(mapPeaks):
    7968             peakMax = np.max(mapPeaks.T[0])
    7969     if 'Plane' not in drawingData:
    7970         drawingData['Plane'] = [[0,0,1],False,False,0.0,[255,255,0]]
    7971     resRBData = data['RBModels'].get('Residue',[])
    7972     vecRBData = data['RBModels'].get('Vector',[])
    7973     rbAtmDict = {}
    7974     for rbObj in resRBData+vecRBData:
    7975         exclList = ['X' for i in range(len(rbObj['Ids']))]
    7976         rbAtmDict.update(dict(zip(rbObj['Ids'],exclList)))
    7977     testRBObj = data.get('testRBObj',{})
    7978     rbObj = testRBObj.get('rbObj',{})
    7979     MCSA = data.get('MCSA',{})
    7980     mcsaModels = MCSA.get('Models',[])
    7981     if len(mcsaModels) > 1:
    7982         XYZs,Types = G2mth.UpdateMCSAxyz(Bmat,MCSA)
    7983         mcsaXYZ = []
    7984         mcsaTypes = []
    7985         neqv = 0
    7986         for xyz,atyp in zip(XYZs,Types):
    7987             equiv = list(G2spc.GenAtom(xyz,SGData,All=True,Move=False))
    7988             neqv = max(neqv,len(equiv))
    7989             for item in equiv:
    7990                 mcsaXYZ.append(item[0])
    7991                 mcsaTypes.append(atyp)
    7992         mcsaXYZ = np.array(mcsaXYZ)
    7993         mcsaTypes = np.array(mcsaTypes)
    7994         nuniq = mcsaXYZ.shape[0]//neqv
    7995         mcsaXYZ = np.reshape(mcsaXYZ,(nuniq,neqv,3))
    7996         mcsaTypes = np.reshape(mcsaTypes,(nuniq,neqv))
    7997         cent = np.fix(np.sum(mcsaXYZ+2.,axis=0)/nuniq)-2
    7998         cent[0] = [0,0,0]   #make sure 1st one isn't moved
    7999         mcsaXYZ = np.swapaxes(mcsaXYZ,0,1)-cent[:,np.newaxis,:]
    8000         mcsaTypes = np.swapaxes(mcsaTypes,0,1)
    8001         mcsaXYZ = np.reshape(mcsaXYZ,(nuniq*neqv,3))
    8002         mcsaTypes = np.reshape(mcsaTypes,(nuniq*neqv))                       
    8003         mcsaBonds = FindPeaksBonds(mcsaXYZ)       
    8004     drawAtoms = drawingData.get('Atoms',[])
    8005     mapData = {}
    8006     showBonds = False
    8007     if 'Map' in generalData:
    8008         mapData = generalData['Map']
    8009         showBonds = mapData.get('Show bonds',False)
    8010     Wt = np.array([255,255,255])
    8011     Rd = np.array([255,0,0])
    8012     Gr = np.array([0,255,0])
    8013     wxGreen = wx.Colour(0,255,0)
    8014     Bl = np.array([0,0,255])
    8015     Or = np.array([255,128,0])
    8016     wxOrange = wx.Colour(255,128,0)
    8017     uBox = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]])
    8018     eBox = np.array([[0,1],[0,0],[1,0],[1,1],])
    8019     eplane = np.array([[-1,-1,0],[-1,1,0],[1,1,0],[1,-1,0]])
    8020     uEdges = np.array([
    8021         [uBox[0],uBox[1]],[uBox[0],uBox[3]],[uBox[0],uBox[4]],[uBox[1],uBox[2]],
    8022         [uBox[2],uBox[3]],[uBox[1],uBox[5]],[uBox[2],uBox[6]],[uBox[3],uBox[7]],
    8023         [uBox[4],uBox[5]],[uBox[5],uBox[6]],[uBox[6],uBox[7]],[uBox[7],uBox[4]]])
    8024     mD = 0.1
    8025     mV = np.array([[[-mD,0,0],[mD,0,0]],[[0,-mD,0],[0,mD,0]],[[0,0,-mD],[0,0,mD]]])
    8026     mapPeakVecs = np.inner(mV,Bmat)
    8027 
    8028     backColor = np.array(list(drawingData['backColor'])+[0,])
    8029     Bc = np.array(list(drawingData['backColor']))
    8030     uColors = [Rd,Gr,Bl,Wt-Bc, Wt-Bc,Wt-Bc,Wt-Bc,Wt-Bc, Wt-Bc,Wt-Bc,Wt-Bc,Wt-Bc]
    8031     G2frame.tau = 0.
    8032     G2frame.seq = 0
    80337939   
    80347940    def OnKeyBox(event):
     
    85648470        if not len(oldxy): oldxy = list(newxy)
    85658471        dxy = newxy-oldxy
     8472        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    85668473        drawingData['oldxy'] = list(newxy)
    85678474        V = np.array([dxy[1],dxy[0],0.])
     
    85888495        if not len(oldxy): oldxy = list(newxy)
    85898496        dxy = newxy-oldxy
     8497        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    85908498        drawingData['oldxy'] = list(newxy)
    85918499        V = drawingData['viewDir']
     
    92219129        Draw('focus')
    92229130       
    9223     # PlotStructure execution starts here (N.B. initialization above)
     9131    # PlotStructure starts here
     9132    global mcsaXYZ,mcsaTypes,mcsaBonds,txID,contourSet,Zslice
     9133    global cell, Vol, Amat, Bmat, A4mat, B4mat
     9134    txID = 0
     9135    ForthirdPI = 4.0*math.pi/3.0
     9136    generalData = data['General']
     9137    cell = generalData['Cell'][1:7]
     9138    ABC = np.array(cell[0:3])
     9139    Vol = generalData['Cell'][7:8][0]
     9140    Amat,Bmat = G2lat.cell2AB(cell)         #Amat - crystal to cartesian, Bmat - inverse
     9141    Gmat,gmat = G2lat.cell2Gmat(cell)
     9142    A4mat = np.concatenate((np.concatenate((Amat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
     9143    B4mat = np.concatenate((np.concatenate((Bmat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
     9144    SGData = generalData['SGData']
     9145    SpnFlp = SGData.get('SpnFlp',[1,])
     9146    atomData = data['Atoms']
     9147    mapPeaks = []
     9148    contourSet = 0
     9149    if generalData.get('DisAglCtrls',{}):
     9150        BondRadii = generalData['DisAglCtrls']['BondRadii']
     9151    else:
     9152        BondRadii = generalData['BondRadii']
     9153
     9154    drawingData = data['Drawing']
     9155    if not drawingData:
     9156        return          #nothing setup, nothing to draw
     9157       
     9158    G2phG.SetDrawingDefaults(drawingData)
     9159    if 'Map Peaks' in data:
     9160        mapPeaks = np.array(data['Map Peaks'])
     9161        peakMax = 100.
     9162        if len(mapPeaks):
     9163            peakMax = np.max(mapPeaks.T[0])
     9164    if 'Plane' not in drawingData:
     9165        drawingData['Plane'] = [[0,0,1],False,False,0.0,[255,255,0]]
     9166    resRBData = data['RBModels'].get('Residue',[])
     9167    vecRBData = data['RBModels'].get('Vector',[])
     9168    rbAtmDict = {}
     9169    for rbObj in resRBData+vecRBData:
     9170        exclList = ['X' for i in range(len(rbObj['Ids']))]
     9171        rbAtmDict.update(dict(zip(rbObj['Ids'],exclList)))
     9172    testRBObj = data.get('testRBObj',{})
     9173    rbObj = testRBObj.get('rbObj',{})
     9174    MCSA = data.get('MCSA',{})
     9175    mcsaModels = MCSA.get('Models',[])
     9176    if len(mcsaModels) > 1:
     9177        XYZs,Types = G2mth.UpdateMCSAxyz(Bmat,MCSA)
     9178        mcsaXYZ = []
     9179        mcsaTypes = []
     9180        neqv = 0
     9181        for xyz,atyp in zip(XYZs,Types):
     9182            equiv = list(G2spc.GenAtom(xyz,SGData,All=True,Move=False))
     9183            neqv = max(neqv,len(equiv))
     9184            for item in equiv:
     9185                mcsaXYZ.append(item[0])
     9186                mcsaTypes.append(atyp)
     9187        mcsaXYZ = np.array(mcsaXYZ)
     9188        mcsaTypes = np.array(mcsaTypes)
     9189        nuniq = mcsaXYZ.shape[0]//neqv
     9190        mcsaXYZ = np.reshape(mcsaXYZ,(nuniq,neqv,3))
     9191        mcsaTypes = np.reshape(mcsaTypes,(nuniq,neqv))
     9192        cent = np.fix(np.sum(mcsaXYZ+2.,axis=0)/nuniq)-2
     9193        cent[0] = [0,0,0]   #make sure 1st one isn't moved
     9194        mcsaXYZ = np.swapaxes(mcsaXYZ,0,1)-cent[:,np.newaxis,:]
     9195        mcsaTypes = np.swapaxes(mcsaTypes,0,1)
     9196        mcsaXYZ = np.reshape(mcsaXYZ,(nuniq*neqv,3))
     9197        mcsaTypes = np.reshape(mcsaTypes,(nuniq*neqv))                       
     9198        mcsaBonds = FindPeaksBonds(mcsaXYZ)       
     9199    drawAtoms = drawingData.get('Atoms',[])
     9200
     9201    mapData = {'MapType':False, 'rho':[]}
     9202    showBonds = False
     9203    if 'Map' in generalData:
     9204        mapData = generalData['Map']
     9205        showBonds = mapData.get('Show bonds',False)
     9206    Wt = np.array([255,255,255])
     9207    Rd = np.array([255,0,0])
     9208    Gr = np.array([0,255,0])
     9209    wxGreen = wx.Colour(0,255,0)
     9210    Bl = np.array([0,0,255])
     9211    Or = np.array([255,128,0])
     9212    wxOrange = wx.Colour(255,128,0)
     9213    uBox = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]])
     9214    eBox = np.array([[0,1],[0,0],[1,0],[1,1],])
     9215    eplane = np.array([[-1,-1,0],[-1,1,0],[1,1,0],[1,-1,0]])
     9216    uEdges = np.array([
     9217        [uBox[0],uBox[1]],[uBox[0],uBox[3]],[uBox[0],uBox[4]],[uBox[1],uBox[2]],
     9218        [uBox[2],uBox[3]],[uBox[1],uBox[5]],[uBox[2],uBox[6]],[uBox[3],uBox[7]],
     9219        [uBox[4],uBox[5]],[uBox[5],uBox[6]],[uBox[6],uBox[7]],[uBox[7],uBox[4]]])
     9220    mD = 0.1
     9221    mV = np.array([[[-mD,0,0],[mD,0,0]],[[0,-mD,0],[0,mD,0]],[[0,0,-mD],[0,0,mD]]])
     9222    mapPeakVecs = np.inner(mV,Bmat)
     9223
     9224    backColor = np.array(list(drawingData['backColor'])+[0,])
     9225    Bc = np.array(list(drawingData['backColor']))
     9226    uColors = [Rd,Gr,Bl,Wt-Bc, Wt-Bc,Wt-Bc,Wt-Bc,Wt-Bc, Wt-Bc,Wt-Bc,Wt-Bc,Wt-Bc]
     9227    G2frame.tau = 0.
     9228    G2frame.seq = 0
     9229   
    92249230    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(generalData['Name'],'ogl')
    92259231    if new:
     
    92639269    # on Mac (& Linux?) the structure must be drawn twice the first time that graphics are displayed
    92649270    if firstCall: Draw('main') # redraw
     9271    return Draw,['main']
    92659272
    92669273################################################################################
     
    92729279    '''
    92739280
    9274     Mydir = G2frame.dirname
    9275     Rd = np.array([255,0,0])
    9276     Gr = np.array([0,255,0])
    9277     Bl = np.array([0,0,255])
    9278     uBox = np.array([[0,0,0],[50,0,0],[0,50,0],[0,0,50]])
    9279     uEdges = np.array([[uBox[0],uBox[1]],[uBox[0],uBox[2]],[uBox[0],uBox[3]]])
    9280     uColors = [Rd,Gr,Bl]
    9281     XYZ = np.array(Atoms[1:]).T      #don't mess with original!
    9282 
    9283 #    def SetRBOrigin():
    9284 #        page = getSelection()
    9285 #        if page:
    9286 #            if G2frame.GetPageText(page) == 'Rigid bodies':
    9287 #                G2frame.MapPeaksTable.SetData(mapPeaks)
    9288 #                panel = G2frame.GetPage(page).GetChildren()
    9289 #                names = [child.GetName() for child in panel]
    9290 #                panel[names.index('grid window')].Refresh()
    9291            
    92929281    def OnMouseDown(event):
    92939282        xy = event.GetPosition()
     
    93359324        if not len(oldxy): oldxy = list(newxy)
    93369325        dxy = newxy-oldxy
     9326        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    93379327        defaults['oldxy'] = list(newxy)
    93389328        V = np.array([dxy[1],dxy[0],0.])
     
    93559345        cent = [View[2]/2,View[3]/2]
    93569346        oldxy = defaults['oldxy']
     9347        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    93579348        if not len(oldxy): oldxy = list(newxy)
    93589349        dxy = newxy-oldxy
     
    94749465            PDB.close()
    94759466            G2frame.G2plotNB.status.SetStatusText('PDB model saved to: '+Fname,1)
    9476     # PlotRigidBody execution starts here (N.B. initialization above)
     9467           
     9468    # PlotBeadModel execution starts here
     9469    Mydir = G2frame.dirname
     9470    Rd = np.array([255,0,0])
     9471    Gr = np.array([0,255,0])
     9472    Bl = np.array([0,0,255])
     9473    uBox = np.array([[0,0,0],[50,0,0],[0,50,0],[0,0,50]])
     9474    uEdges = np.array([[uBox[0],uBox[1]],[uBox[0],uBox[2]],[uBox[0],uBox[3]]])
     9475    uColors = [Rd,Gr,Bl]
     9476    XYZ = np.array(Atoms[1:]).T      #don't mess with original!
    94779477    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('Bead model','ogl')
    94789478    if new:
     
    95089508    '''RB plotting package. Can show rigid body structures as balls & sticks
    95099509    '''
    9510 
    95119510    def FindBonds(XYZ):
    95129511        rbTypes = rbData['rbTypes']
     
    95289527        return Bonds
    95299528                       
    9530     Mydir = G2frame.dirname
    9531     Rd = np.array([255,0,0])
    9532     Gr = np.array([0,255,0])
    9533     Bl = np.array([0,0,255])
    9534     uBox = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]])
    9535     uEdges = np.array([[uBox[0],uBox[1]],[uBox[0],uBox[2]],[uBox[0],uBox[3]]])
    9536     uColors = [Rd,Gr,Bl]
    9537     if rbType == 'Vector':
    9538         atNames = [str(i)+':'+Ty for i,Ty in enumerate(rbData['rbTypes'])]
    9539         XYZ = np.array([[0.,0.,0.] for Ty in rbData['rbTypes']])
    9540         for imag,mag in enumerate(rbData['VectMag']):
    9541             XYZ += mag*rbData['rbVect'][imag]
    9542         Bonds = FindBonds(XYZ)
    9543     elif rbType == 'Residue':
    9544 #        atNames = [str(i)+':'+Ty for i,Ty in enumerate(rbData['atNames'])]
    9545         atNames = rbData['atNames']
    9546         XYZ = np.copy(rbData['rbXYZ'])      #don't mess with original!
    9547         Seq = rbData['rbSeq']
    9548         for ia,ib,ang,mv in Seq:
    9549             va = XYZ[ia]-XYZ[ib]
    9550             Q = G2mth.AVdeg2Q(ang,va)
    9551             for im in mv:
    9552                 vb = XYZ[im]-XYZ[ib]
    9553                 vb = G2mth.prodQVQ(Q,vb)
    9554                 XYZ[im] = XYZ[ib]+vb
    9555         Bonds = FindBonds(XYZ)
    9556     elif rbType == 'Z-matrix':
    9557         pass
    9558 
    95599529#    def SetRBOrigin():
    95609530#        page = getSelection()
     
    96119581        if not len(oldxy): oldxy = list(newxy)
    96129582        dxy = newxy-oldxy
     9583        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    96139584        defaults['oldxy'] = list(newxy)
    96149585        V = np.array([dxy[1],dxy[0],0.])
     
    96339604        if not len(oldxy): oldxy = list(newxy)
    96349605        dxy = newxy-oldxy
     9606        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    96359607        defaults['oldxy'] = list(newxy)
    96369608        V = defaults['viewDir']
     
    97299701        RenderUnitVectors(0.,0.,0.)
    97309702        radius = 0.2
     9703        s = 1
     9704        selected = rbData.get('Selection')
    97319705        for iat,atom in enumerate(XYZ):
     9706            if selected:
     9707                if selected[iat]:
     9708                    s = 1
     9709                else:
     9710                    s = 3
    97329711            x,y,z = atom
    97339712            CL = AtInfo[rbData['rbTypes'][iat]][1]
    9734             color = np.array(CL)/255.
     9713            color = np.array(CL)/(s*255.)
    97359714            RenderSphere(x,y,z,radius,color)
    97369715            RenderBonds(x,y,z,Bonds[iat],0.05,color)
     
    97759754            G2frame.G2plotNB.status.SetStatusText('Drawing saved to: '+Fname,1)
    97769755
    9777     # PlotRigidBody execution starts here (N.B. initialization above)
     9756    def UpdateDraw():
     9757        '''This updates the drawing arrays in place'''
     9758        for i,Ty in enumerate(rbData['rbTypes']):
     9759            atNames[i] = str(i)+':'+Ty
     9760        for i in range(len(XYZ)):
     9761            XYZ[i].fill(0)
     9762            for imag,mag in enumerate(rbData['VectMag']):
     9763                XYZ[i] += mag*rbData['rbVect'][imag][i]
     9764        # number of bonds should not change (=# of atoms)
     9765        newBonds = FindBonds(XYZ)
     9766        for i in range(len(Bonds)):
     9767            Bonds[i] = newBonds[i]
     9768        Draw() # drawing twice seems needed sometimes at least on mac
     9769        Draw()
     9770       
     9771    # PlotRigidBody execution starts here
     9772    Mydir = G2frame.dirname
     9773    Rd = np.array([255,0,0])
     9774    Gr = np.array([0,255,0])
     9775    Bl = np.array([0,80,255]) # blue on black is hard to see
     9776    uBox = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]])
     9777    uEdges = np.array([[uBox[0],uBox[1]],[uBox[0],uBox[2]],[uBox[0],uBox[3]]])
     9778    uColors = [Rd,Gr,Bl]
     9779    if rbType == 'Vector':
     9780        atNames = [str(i)+':'+Ty for i,Ty in enumerate(rbData['rbTypes'])]
     9781        XYZ = np.array([[0.,0.,0.] for Ty in rbData['rbTypes']])
     9782        for imag,mag in enumerate(rbData['VectMag']):
     9783            XYZ += mag*rbData['rbVect'][imag]
     9784        Bonds = FindBonds(XYZ)
     9785    elif rbType == 'Residue':
     9786#        atNames = [str(i)+':'+Ty for i,Ty in enumerate(rbData['atNames'])]
     9787        atNames = rbData['atNames']
     9788        XYZ = np.copy(rbData['rbXYZ'])      #don't mess with original!
     9789        Seq = rbData['rbSeq']
     9790        for ia,ib,ang,mv in Seq:
     9791            va = XYZ[ia]-XYZ[ib]
     9792            Q = G2mth.AVdeg2Q(ang,va)
     9793            for im in mv:
     9794                vb = XYZ[im]-XYZ[ib]
     9795                vb = G2mth.prodQVQ(Q,vb)
     9796                XYZ[im] = XYZ[ib]+vb
     9797        Bonds = FindBonds(XYZ)
     9798    elif rbType == 'Z-matrix':
     9799        pass
     9800    else:
     9801        print('rbType=', rbType)
     9802        if GSASIIpath.GetConfigValue('debug'): raise Exception('Should not happen')
     9803
    97789804    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('Rigid body','ogl')
    97799805    if new:
     
    98029828    Draw('main')
    98039829    Draw('main')    #to fill both buffers so save works
    9804 
     9830    if rbType == 'Vector': return UpdateDraw
    98059831################################################################################
    98069832#### Plot Layers
     
    1003210058        if not len(oldxy): oldxy = list(newxy)
    1003310059        dxy = newxy-oldxy
     10060        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    1003410061        defaults['oldxy'] = list(newxy)
    1003510062        V = np.array([dxy[1],dxy[0],0.])
     
    1005210079        cent = [View[2]/2,View[3]/2]
    1005310080        oldxy = defaults['oldxy']
     10081        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    1005410082        if not len(oldxy): oldxy = list(newxy)
    1005510083        dxy = newxy-oldxy
Note: See TracChangeset for help on using the changeset viewer.