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')