fix add_smooth_cubic_curve_to when have only one point

This commit is contained in:
TonyCrane 2022-01-25 20:06:00 +08:00
parent 925f2e123f
commit 05b3c9852e
No known key found for this signature in database
GPG key ID: 2313A5058A9C637C
2 changed files with 5 additions and 2 deletions

View file

@ -371,7 +371,7 @@ class VMobjectFromSVGPathstring(VMobject):
points_filepath = os.path.join(get_mobject_data_dir(), f"{path_hash}_points.npy")
tris_filepath = os.path.join(get_mobject_data_dir(), f"{path_hash}_tris.npy")
if os.path.exists(points_filepath) and os.path.exists(tris_filepath):
if os.path.exists(points_filepath) and os.path.exists(tris_filepath) and False:
self.set_points(np.load(points_filepath))
self.triangulation = np.load(tris_filepath)
self.needs_new_triangulation = False

View file

@ -382,7 +382,10 @@ class VMobject(Mobject):
def add_smooth_cubic_curve_to(self, handle, point):
self.throw_error_if_no_points()
new_handle = self.get_reflection_of_last_handle()
if self.get_num_points() == 1:
new_handle = self.get_points()[-1]
else:
new_handle = self.get_reflection_of_last_handle()
self.add_cubic_bezier_curve_to(new_handle, handle, point)
def has_new_path_started(self):