scarpe-team / scarpe

Scarpe - shoes but running on webview
Other
162 stars 29 forks source link

Enhancement: Incorporating tooltips, font customization, and stroke options into editline component #546

Closed Nj221102 closed 6 months ago

Nj221102 commented 6 months ago

Description

This pull request significantly improves a legacy example, transitioning it from a non-functional state to a fully functional one by integrating crucial features such as tooltips, font customization, and stroke options into the editline component.

Summary of Changes:

  1. Feature Enhancements:

    • Implemented support for tooltips, font customization, and stroke options within the editline component, enhancing its functionality and usability.
  2. Directory Relocation:

    • Moved the example from the "not working" directory to the "working" directory since it is now functional, ensuring it is housed appropriately for clarity and organization.
  3. Font Parsing Enhancement:

    • Improved the font_parse method to handle various font input formats, including cases where only the font size is provided without a unit (e.g., "monaco 9"). Previously, direct numerical inputs for font size lacked a unit, resulting in no change to font size. The updated method now detects if the font size portion of the font property includes a unit. If no unit is present, it automatically appends "px" as the default unit, ensuring consistent and correct font sizing behavior.
  4. Test Adjustment:

    • Adjusted relevant tests for the editline component to accommodate changes in fixtures resulting from the introduction of new features. This ensures that the tests accurately reflect the updated functionality of the component.

These enhancements not only resolve existing issues but also improve the overall functionality and maintainability of the editline component, contributing to a better user experience and smoother development process.

The Example mentioned in PR

Shoes.app height: 300, width: 300 do
  stack do
    flow do
      para "Normal "
       @el1 = edit_line "Normal", tooltip: "Normal"
    end
    flow do 
      para "Font  "
      @el2 = edit_line "Font Is?", font: "Monaco 9", tooltip: "monaco 9"
    end
    flow do
      para "Stroke "
      @el3 = edit_line "Stroke", stroke: red, tooltip: "red"
    end
    flow do
      para "Both"
      @el4 = edit_line "Stroke and Font", stroke: green, font: "Arial 14",
       tooltip: "green arial 14"
    end
    button "change contents" do
      @el1.text = "Changed!"
      @el2.text = "Changed!"
      @el3.text = "Changed!"
      @el4.text = "Changed!"
    end
  end
end

Image(if needed, helps for a faster review)

Screenshot 2024-02-18 at 2 55 19 AM

Checklist