Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line/SmoothLine - ellipse: Handle the number of segments to match Ellipse #8187

Merged
merged 1 commit into from Mar 28, 2023

Conversation

DexerBR
Copy link
Contributor

@DexerBR DexerBR commented Mar 26, 2023

demo.mp4

Source code:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout


class UI(BoxLayout):
    pass


Builder.load_string(
    """
<UI>:
    start_angle: 0
    end_angle: 0
    segments: 100
    close: 0
    close_mode: "straight-line"

    BoxLayout:
        orientation: "vertical"
        canvas:
            Color:
                rgba: 0.2, 0.2, 0.2, 1
            Rectangle:
                pos: self.pos
                size: self.size

            Color:
                rgba: 0, 0, 0, 1
            Ellipse:
                pos: self.center_x - 100, self.center_y
                size: 200, 200
                angle_start: root.start_angle
                angle_end: root.end_angle
                segments: root.segments

            Color:
                rgba: 1, 1, 1, 1
            SmoothLine:
                width: 1
                overdraw_width: 2
                ellipse: (self.center_x - 100, self.center_y, 200, 200, root.start_angle, root.end_angle, root.segments)
                close: root.close
                close_mode: root.close_mode

        Label:
            text: f"start_angle: {root.start_angle} | end_angle: {root.end_angle} | segments: {root.segments}"
            size_hint_y: None
            height: 50
        
        BoxLayout:
            size_hint_y: None
            height: self.minimum_height
            Label:
                text: "close"
            Switch:
                size_hint_y: None
                height: 40
                on_active:
                    root.close = int(self.active)
        BoxLayout:
            size_hint_y: None
            height: self.minimum_height
            Label:
                text: "straight-line"
            CheckBox:
                group: "mode"
                size_hint_y: None
                height: 40
                allow_no_selection: False
                active: True
                on_active:
                    root.close_mode = "straight-line"
            Label:
                text: "center-connected"
            CheckBox:
                group: "mode"
                size_hint_y: None
                height: 40
                allow_no_selection: False
                on_active:
                    root.close_mode = "center-connected"
                    
        Slider:
            size_hint_y: None
            height: 50
            min: -360
            max: 360
            step: 1
            on_value:
                root.start_angle = self.value
        Slider:
            size_hint_y: None
            height: 50
            min: -360
            max: 360
            step: 1
            on_value:
                root.end_angle = self.value
        Slider:
            size_hint_y: None
            height: 50
            min: -10
            max: 150
            step: 1
            on_value:
                root.segments = int(self.value)
"""
)


class Testapp(App):

    def build(self):
        return UI()


Testapp().run()

Maintainer merge checklist

  • Title is descriptive/clear for inclusion in release notes.
  • Applied a Component: xxx label.
  • Applied the api-deprecation or api-break label.
  • Applied the release-highlight label to be highlighted in release notes.
  • Added to the milestone version it was merged into.
  • Unittests are included in PR.
  • Properly documented, including versionadded, versionchanged as needed.

@DexerBR DexerBR changed the title Line/SmoothLine - ellipse: Handle the number of segments to matchEllipse Line/SmoothLine - ellipse: Handle the number of segments to match Ellipse Mar 26, 2023
@misl6 misl6 added the Component: graphics kivy/graphics label Mar 28, 2023
@misl6 misl6 added this to the 2.2.0 milestone Mar 28, 2023
@misl6 misl6 self-assigned this Mar 28, 2023
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@misl6 misl6 merged commit 34f2edb into kivy:master Mar 28, 2023
34 checks passed
@DexerBR DexerBR deleted the line_ellipse_segments branch March 28, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: graphics kivy/graphics
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants