change snap for nicer match when mouse outside box
This commit is contained in:
@@ -2,7 +2,7 @@ import argparse
|
||||
|
||||
from tsmark.video_annotator import Marker
|
||||
|
||||
VERSION = "0.7.12"
|
||||
VERSION = "0.7.13"
|
||||
|
||||
|
||||
class SmartFormatter(argparse.HelpFormatter):
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user