Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

import functools 

 

_editor = None 

 

def motionEvent(view, obj, eventId): 

    _editor.handleTDxMotionEvent(view.lastTDxMotion()) 

 

def init(view, editor): 

 

    tdxStyle = view.renderWindow().GetInteractor().GetInteractorStyle().GetTDxStyle() 

    if tdxStyle is None: 

        return 

 

    global _editor 

    _editor = editor 

    tdxSettings = tdxStyle.GetSettings() 

 

    translationSensitivity = 0.1 

    angleSensitivity = 0.1 

    tdxSettings.SetAngleSensitivity(angleSensitivity) 

    tdxSettings.SetTranslationXSensitivity(translationSensitivity) 

    tdxSettings.SetTranslationYSensitivity(translationSensitivity) 

    tdxSettings.SetTranslationZSensitivity(translationSensitivity) 

 

    eventHandler = functools.partial(motionEvent, view) 

    tdxStyle.AddObserver('TDxMotionEvent', eventHandler)