MCPcopy Create free account
hub / github.com/Image-Py/imagepy / lay

Function lay

imagepy/ui/canvas.py:29–38  ·  view source on GitHub ↗
(r1, r2)

Source from the content-addressed store, hash-verified

27 return [ceil(i) for i in r]
28
29def lay(r1, r2):
30 if r2[2]<=r1[2]:r2[0]=(r1[2]-r2[2])//2+r1[0]
31 elif r2[0]>r1[0]:r2[0]=r1[0]
32 elif r2[0]+r2[2]<r1[0]+r1[2]:
33 r2[0]=r1[0]+r1[2]-r2[2]
34
35 if r2[3]<=r1[3]:r2[1]=(r1[3]-r2[3])//2+r1[1]
36 elif r2[1]>r1[1]:r2[1]=r1[1]
37 elif r2[1]+r2[3]<r1[1]+r1[3]:
38 r2[1]=r1[1]+r1[3]-r2[3]
39
40def trans(r1, r2):
41 return [r2[0]-r1[0], r2[1]-r1[1], r2[2], r2[3]]

Callers 3

zoomMethod · 0.85
centerMethod · 0.85
updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected