diff --git a/tsmark/__init__.py b/tsmark/__init__.py index 7121253..82c4191 100644 --- a/tsmark/__init__.py +++ b/tsmark/__init__.py @@ -2,7 +2,7 @@ import argparse from tsmark.video_annotator import Marker -VERSION = "0.7.12" +VERSION = "0.7.13" class SmartFormatter(argparse.HelpFormatter): diff --git a/tsmark/video_annotator.py b/tsmark/video_annotator.py index e2de2f6..2e14a39 100755 --- a/tsmark/video_annotator.py +++ b/tsmark/video_annotator.py @@ -506,6 +506,18 @@ class Marker: "Return x0/x1/y1/y0 side depending which the xy coord is farthest" snap_map = {True: {True: "y1", False: "x0"}, False: {True: "x1", False: "y0"}} + if xy[1] > bbox["y0"] and xy[1] < bbox["y1"]: + if xy[0] < bbox["x0"]: + return "x1" + if xy[0] > bbox["x1"]: + return "x0" + + if xy[0] > bbox["x0"] and xy[0] < bbox["x1"]: + if xy[1] < bbox["y0"]: + return "y1" + if xy[1] > bbox["y1"]: + return "y0" + x_diff = xy[0] - bbox["cx"] y_diff = xy[1] - bbox["cy"]