From 053c1319034e582e2662706f917584887b748a8f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 30 Apr 2020 00:02:42 +0800 Subject: [PATCH] bugfix --- kivyblocks/baseWidget.py | 7 +++++++ kivyblocks/register.py | 1 + kivyblocks/swipebehavior.py | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/kivyblocks/baseWidget.py b/kivyblocks/baseWidget.py index f2c4421..a842b10 100755 --- a/kivyblocks/baseWidget.py +++ b/kivyblocks/baseWidget.py @@ -67,6 +67,13 @@ if platform == 'android': from .widgetExt.androidwebview import AWebView from .widgetExt.camera import AndroidCamera +class WrapText(Label): + def __init__(self, **kw): + Label.__init__(self, **kw) + self.bind(width=lambda *x: self.setter('text_size')(self, (self.width, None)), + texture_size=lambda *x: self.setter('height')(self, self.texture_size[1])) + + class Text(BGColorBehavior, Label): def __init__(self,bgcolor=[],fgcolor=[],color_level=-1,**kw): self.options = DictObject(**kw) diff --git a/kivyblocks/register.py b/kivyblocks/register.py index 7631398..a61d956 100644 --- a/kivyblocks/register.py +++ b/kivyblocks/register.py @@ -40,6 +40,7 @@ r('TextTree',TextTree) r('PopupMenu',PopupMenu) r('HostImage',HostImage) r('APlayer',APlayer) +r('WrapText',WrapText) if platform == 'android': r('PhoneButton',PhoneButton) r('AWebView',AWebView) diff --git a/kivyblocks/swipebehavior.py b/kivyblocks/swipebehavior.py index 50d46e8..1ca0f95 100644 --- a/kivyblocks/swipebehavior.py +++ b/kivyblocks/swipebehavior.py @@ -70,6 +70,12 @@ class SwipeBehavior(object): self.dispatch('on_context_menu') def check_swipe(self): + if not self.sb_end_point: + return + + if not self.sb_start_point: + return + if abs(self.sb_end_point[0] - self.sb_start_point[0]) > \ abs(self.sb_end_point[1] - self.sb_start_point[1]): Logger.info('SwipeBehavior:check_swipe x>y')