Hide keyboard shortcuts

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

# SPDX-License-Identifier: MIT 

 

 

def mm2inch(mm): 

return mm * 0.0393700787 

 

 

def ms2s(ms): 

return ms / 1000.0 

 

 

class EventData(object): 

def __init__(self, x=0, y=0): 

self.x = x 

self.y = y 

 

@staticmethod 

def from_mm(dpi, x=0, y=0): 

return EventData(x=int(round(mm2inch(x) * dpi)), 

y=int(round(mm2inch(y) * dpi))) 

 

@staticmethod 

def from_action(dpi, action: dict): 

assert action['type'] == 'xy' 

return EventData(x=int(round(mm2inch(action['data']['x']) * dpi)), 

y=int(round(mm2inch(action['data']['y']) * dpi)))