MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / move_object

Function move_object

src/table.py:1032–1051  ·  view source on GitHub ↗
(obj, axis: str, value)

Source from the content-addressed store, hash-verified

1030
1031
1032def move_object(obj, axis: str, value):
1033 assert axis in ("h", "v")
1034 if axis == "h":
1035 new_items = [
1036 ("x0", obj["x0"] + value),
1037 ("x1", obj["x1"] + value),
1038 ]
1039 if axis == "v":
1040 new_items = [
1041 ("top", obj["top"] + value),
1042 ("bottom", obj["bottom"] + value),
1043 ]
1044 if "doctop" in obj:
1045 new_items += [("doctop", obj["doctop"] + value)]
1046 if "y0" in obj:
1047 new_items += [
1048 ("y0", obj["y0"] - value),
1049 ("y1", obj["y1"] - value),
1050 ]
1051 return obj.__class__(tuple(obj.items()) + tuple(new_items))
1052
1053
1054def snap_objects(objs, attr: str, tolerance) -> list:

Callers 1

snap_objectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…