Beispiel #1
0
	def on_touch_down(self, touch):
		self.cursorpos=touch.pos
		x, y = self.cursorpos
		self.cursor.pos=(x-40, y-40);
		self.cursor.visible=True;
		Widget.on_touch_down(self, touch)
		self.on_air(touch)
Beispiel #2
0
    def on_touch_down(self, touch):  # on_touch_down is the event of Widget
        if Widget.on_touch_down(self, touch):
            return

        with self.canvas:
            Color(*get_color_from_hex('#0080FF80'))
            touch.ud['current_line'] = Line(points=(touch.x, touch.y), width=2)
Beispiel #3
0
    def on_touch_down(self, touch):  # on_touch_down is the event of Widget
        if Widget.on_touch_down(self, touch):
            return

        with self.canvas:
            touch.ud['current_line'] = Line(points=(touch.x, touch.y),
                                            width=self.line_width)
Beispiel #4
0
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self, touch):
            return

        with self.canvas:
            touch.ud['line'] = Line(points=(touch.x, touch.y),
                                    width=self.line_width)
Beispiel #5
0
 def on_touch_move(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     if self.locked:
         return
     if 'current_line' in touch.ud:
         touch.ud['current_line'].points += (touch.x, touch.y)
Beispiel #6
0
    def on_touch_down(self, touch):
        self.set_color(self.color_paint)
        if Widget.on_touch_down(self, touch):
            return

        with self.canvas:
            if 45 < touch.y < self.height - 45 and 25 < touch.x < self.width - 25:
                if self.shape == 1:
                    touch.ud['current_line'] = Line(
                        points=(touch.x - self.defaut_size / 2,
                                touch.y - self.defaut_size / 2),
                        width=self.line_width)
                elif self.shape == 2:
                    self.start_x = touch.x - self.defaut_size / 2
                    self.start_y = touch.y - self.defaut_size / 2
                    touch.ud['current_ellipse'] = Ellipse(
                        pos=(touch.x - self.defaut_size / 2,
                             touch.y - self.defaut_size / 2),
                        size=(self.defaut_size, self.defaut_size))
                elif self.shape == 3:
                    self.start_x = touch.x
                    self.start_y = touch.y - self.defaut_size
                    touch.ud['current_rectangle'] = Rectangle(
                        pos=(touch.x, touch.y - self.defaut_size),
                        size=(self.defaut_size, self.defaut_size))
                elif self.shape == 4:
                    touch.ud['current_triangle'] = Triangle(
                        points=(touch.x, touch.y,
                                touch.x + self.defaut_size / 2,
                                touch.y + self.defaut_size,
                                touch.x + self.defaut_size, touch.y))
Beispiel #7
0
 def on_touch_move(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     if self.locked:
         return
     if 'current_line' in touch.ud:
         touch.ud['current_line'].points += (touch.x, touch.y)
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     with self.canvas:
         #Line(circle = (touch.x, touch.y, 25 ), width = 4)
         touch.ud["current_line"] = Line(points=(touch.x, touch.y),
                                         width=self.line_width)
Beispiel #9
0
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     with self.canvas:
         #ud : User Data
         touch.ud['current_line'] = Line(points=(touch.x, touch.y),
                                         width=self.line_width)
 def on_touch_down(self, touch):
     """触摸显示轨迹"""
     if Widget.on_touch_down(self, touch):
         return
     with self.canvas:
         touch.ud['current_line'] = Line(points=(touch.x, touch.y),
                                         width=self.line_width)
Beispiel #11
0
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     
     with self.canvas:
         Color(*get_color_from_hex('#0080FF80'))
         touch.ud['current_line'] = Line(points=(touch.x, touch.y), width=2)
Beispiel #12
0
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     with self.canvas:
         touch.ud['current_line'] = Line(
             points=(touch.x, touch.y),
             width=self.line_width
         )
Beispiel #13
0
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self,touch):
            return

        with self.canvas:
            # This draws an empty circle around every touch that our widget receives
            #
            touch.ud['current_line'] = Line(points=(touch.x,touch.y),width = self.line_width)
    def on_touch_up(self, touch):
        #print "up"
        global xs, ys, press, wide

        if incanvasxy(self, xs, ys):
            if incanvasxy(self, touch.x, touch.y):

                if sline:

                    self.col = retclr()

                    if Widget.on_touch_down(self, touch):
                        return True
                    with self.canvas:
                        Color(*self.col)
                        Line(points=(touch.x, touch.y, xs, ys), width=wide)
                if rect:

                    self.col = retclr()

                    if Widget.on_touch_down(self, touch):
                        return True
                    with self.canvas:
                        Color(*self.col)
                        Line(rectangle=(xs, ys, touch.x - xs, touch.y - ys),
                             width=wide)
            else:
                if press:
                    if sline:
                        with self.canvas:
                            if xboun:
                                Color(*self.col)
                                Line(points=(xboun, yboun, xs, ys), width=wide)
                        self.canvas.after.clear()
                    if rect:
                        with self.canvas:
                            if xboun:
                                Color(*self.col)
                                Line(rectangle=(xs, ys, xboun - xs,
                                                yboun - ys),
                                     width=wide)
                        self.canvas.after.clear()
        self.canvas.after.clear()
        default(self)
        press = 0
Beispiel #15
0
    def on_touch_down(self, touch):
        for widget in self.children:
            widget.on_touch_down(touch)

        with self.canvas:
            touch.ud['current_line'] = Line(points=(touch.x, touch.y), width=2)

        if Widget.on_touch_down(self, touch):
            return
Beispiel #16
0
    def on_touch_down(self, touch):
        # Check if any of the children components reacted to the click event
        if Widget.on_touch_down(self, touch):
            # A component has reacted to the click, so don't
            # draw the circle
            return

        with self.canvas:
            touch.ud['current_line'] = Line(points=(touch.x, touch.y),
                                            width=self.line_width)
Beispiel #17
0
 def on_touch_down(self, touch):
     # if not self.collide_point(touch.x, touch.y):
     #     return False
     with touch_to_local(touch, self):
         if Widget.on_touch_down(self, touch):
             return True
         if len(self.touch_handlers) > 0:
             for handler in self.touch_handlers:
                 if handler.on_touch_down(touch):
                     return True
     return False
Beispiel #18
0
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self, touch) or not self.isInCanvas(touch):
            # ボタンなどのウィジット上でタッチした場合は処理をスルー
            return

        h, w = self.srcimg.shape[:2]
        m = self.margin
        ud = touch.ud
        x = touch.x if touch.x < w + 2 * m else touch.x - (w + 2 * m)

        if self.nowFraming():  # 枠設定中
            g = str(self.fState)
            with self.canvas:
                # Color(ud['color'], 1, 1, mode='hsv', group=g)
                Color(0, 1, 0, mode='rgba', group=g)
                ud['cross'] = [
                    Rectangle(pos=(x, BUTTONH), size=(1, h),
                              group=g),  # クロスカーソル 縦
                    Rectangle(pos=(0, touch.y),
                              size=(2 * (w + 2 * m), 1),
                              group=g),  # クロスカーソル 横
                    Rectangle(pos=(x + w + 2 * m, BUTTONH),
                              size=(1, h),
                              group=g)
                ]
            ud['label'] = Label(size_hint=(None, None))
            self.update_touch_label(ud['label'], touch)
            self.add_widget(ud['label'])
        else:
            mark = self.nowMarking()
            if mark < 0:  # not on marking
                return

            ud['group'] = g = str(touch.uid)
            ps = self.pointsize

            with self.canvas:
                exec(COLORS[mark])
                # ud['drawings'] = Point(points=(touch.x, touch.y), source='res/picdicpics/particle.png',
                ud['drawings'] = [
                    Point(points=(x, touch.y),
                          source='res/picdicpics/ic12_pennib.png',
                          pointsize=ps,
                          group=g),
                    Point(points=(x + w + 2 * m, touch.y),
                          source='res/picdicpics/ic15_pennib64.png',
                          pointsize=ps,
                          group=g)
                ]
                self.drawPoint(ud['drawings'][0].points,
                               colorvalue=DRAW_COLORS[mark])
        self.pushCV(g)
        touch.grab(self)  # ドラッグの追跡を指定
        return True
Beispiel #19
0
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self, touch):
            return

        # color = (random(), 1, 1)
        with self.canvas:
            #Color(*color, mode='hsv')
            #d = 30.
            #Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
            touch.ud['line'] = Line(points=(touch.x, touch.y),
                                    width=self.line_width)
Beispiel #20
0
    def on_touch_down(self, touch):
        # avoid painting line on button
        if Widget.on_touch_down(self, touch):
            return
        if self.locked:
            return

        with self.canvas:
            # add line primitive
            Color(*get_color_from_hex("#0080FF80"))
            touch.ud['current_line'] = Line(
                points=(touch.x, touch.y), width=10)
Beispiel #21
0
    def on_touch_down(self, touch):
        # avoid painting line on button
        if Widget.on_touch_down(self, touch):
            return
        if self.locked:
            return

        with self.canvas:
            # add line primitive
            Color(*get_color_from_hex("#0080FF80"))
            touch.ud['current_line'] = Line(points=(touch.x, touch.y),
                                            width=10)
Beispiel #22
0
	def on_touch_down(self, touch):

		if self.fName and self.fName.collide_point(touch.x, touch.y): #we only handle the touch if it's over our Name. Making the Name object handle the touch itself
														#might seem more sensible but I promise it's not. :)
			if not self.isRoot():
				print("need to deparent and stuff")
			else:
				print("I AM ROOT")
				
			DragNDropWidget.on_touch_down(self, touch)
		else:
			#this make the touch bubble to some other widget. maybe touch.bubble() would be a less retarded syntax, Kivy folks?
			return Widget.on_touch_down(self, touch)
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self, touch):  # used to press back button
            return True

        with self.canvas.before:  # the canvas drawing part
            Color(1, 1, 0)
            self.old_touch_x = touch.x  # initialize with the starting points
            self.old_touch_y = touch.y
            touch.ud['line'] = Line(points=(touch.x, touch.y))
            touch.ud['line2'] = Line(
                points=(touch.x,
                        touch.y - 20))  # starts a new line with +20 offset
            # ---- the new line only works for drawing horizontal ----
            print("mouse donw:", touch.pos)
Beispiel #24
0
    def on_touch_down(self, touch):
        if Widget.on_touch_down(self,
                                touch):  # used to press buttons on screen
            return True

        with self.canvas.before:  # the canvas drawing part
            Color(1, 1, 0)
            self.last_point_x = touch.x  # initialize with the starting points
            self.last_point_y = touch.y
            self.first_point_x = touch.x
            self.first_point_y = touch.y
            touch.ud['line'] = Line(points=(touch.x, touch.y))  # shows line
            print("mouse down:", touch.pos)
            self.d.append(Vector2(self.first_point_x,
                                  self.first_point_y))  # append to list
            self.check = 1  # check completed
Beispiel #25
0
    def on_touch_down(self, touch):
        # print "down"
        global xs, ys, xboun, yboun, press, wide
        press = 1
        if incanvasxy(self, touch.x, touch.y):

            self.col = retclr()
            if Widget.on_touch_down(self, touch):
                xs = touch.x
                ys = touch.y
                return True

            with self.canvas:
                Color(*self.col)
                d = 30
                #Line(pos=(touch.x - d / 2,touch.y - d / 2), size=(d,d))
                touch.ud['line'] = Line(points=(touch.x, touch.y), width=wide)
                # if sline:
                xs = touch.x
                ys = touch.y
        else:
            xs = touch.x
            ys = touch.y
        default(self)
Beispiel #26
0
 def on_touch_up(self, touch):
     if (self.enabled == True):
         Widget.on_touch_down(self, touch)
     else:
         pass
Beispiel #27
0
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch):
         return
     ripple = Ripple(touch)
     self.add_widget(ripple)
     ripple.animation.start(ripple)
Beispiel #28
0
 def on_touch_down(self, touch):
     if Widget.on_touch_down(self, touch): return
     with self.canvas:
         pass
         Color(*get_color_from_hex("#23847280"))
         touch.ud["line"] = Line(points=(touch.x, touch.y), width=10)