Skip to content

Commit ecc4a7d

Browse files
Height and width in pixels
1 parent 7c3be2d commit ecc4a7d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pybabylonjs/args.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,20 @@ def check_point_cloud_args(source, mode, point_cloud_args_in):
7373
if key is not None:
7474
point_cloud_args[key] = point_cloud_args_in.pop(key)
7575

76-
if not "height" in point_cloud_args:
77-
point_cloud_args["height"] = 600
78-
point_cloud_args["width"] = 800
76+
def in_pixels(h, default):
77+
if h is None:
78+
return default
79+
if isinstance(h, str):
80+
if "px" in h:
81+
return h
82+
return h + "px"
83+
if isinstance(h, int):
84+
return str(h) + "px"
85+
if isinstance(h, float):
86+
return str(int(h)) + "px"
87+
88+
point_cloud_args["height"] = in_pixels(point_cloud_args.get("height"), "500px")
89+
point_cloud_args["width"] = in_pixels(point_cloud_args.get("width"), "700px")
7990

8091
if not "token" in point_cloud_args:
8192
try:

0 commit comments

Comments
 (0)