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

Cap #428

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Cap #428

wants to merge 3 commits into from

Conversation

gintama91
Copy link
Collaborator

@gintama91 gintama91 commented Oct 22, 2023

Description

Cap, strokewidth and transform-origin

Image(if needed, helps for a faster review)

Checklist

  • Run tests locally
  • Run linter(check for linter errors)

gintama91 and others added 3 commits October 19, 2023 12:08
* generating files is broken due to repo changes

* progress

* fraction

* progress added fraction and refactored code
@gintama91
Copy link
Collaborator Author

will update tests along with adding a example and maybe del too.

@@ -7,7 +7,7 @@ def arc_element(props, &block)
HTML.render do |h|
h.div(id: html_id, style: arc_style(props)) do
h.svg(width: props["width"], height: props["height"]) do
h.path(d: arc_path(props), transform: "rotate(#{rotate}, #{props["width"] / 2}, #{props["height"] / 2})")
h.path(d: arc_path(props), transform: "rotate(#{rotate}, #{props["width"] / 2}, #{props["height"] / 2})","transform-box": "fill-box","transform-origin": "50% 50%")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is changing the transform-origin going to change all existing rotations on arc, etc?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That might be fine, but is this the right one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no transform-origin is for something else, i fogot , for cap its only for line i think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

transform origin is for some property where svg should be spinned based on center or corner i forgot what it is for in shoes i will look and get back in a sec

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah here for this one we need transform-origin but rotating based on center or corner is weird in svgs so i still had to look into them

https://github.com/gintama91/scarpe/blob/444e080e29cb20d133181292b854524531fc3923/docs/static/manual.md?plain=1#L1852

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in some article i read we now dont need to think about matrixes and stuff but i still dont really understand if it even changes to center or curve coz arc is just practically disappearing slowly. (i am probably doing something wrong.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wait sorry i just realised what you asked is completely different , sorry

yeah i need to get it from drawing context and update to either center or corner

HTML.render do |h|
h.div(id: html_id, style: line_div_style(props)) do
h.svg(width: props["x2"], height: props["y2"]) do
h.line(x1: props["left"], y1: props["top"], x2: props["x2"], y2: props["y2"], style: line_svg_style(props))
h.line(x1: props["left"], y1: props["top"], x2: props["x2"], y2: props["y2"], style: line_svg_style(props), "stroke-linecap":cap,"transform-origin": "center right")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add these using symbols with the colon-string syntax:

:"stroke-linecap": cap, :"transform-origin": "center right"

That will then not set stroke-linecap any time cap is nil, for instance, as well as matching the rest of the properties everywhere else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oo okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants