andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
918 stars 67 forks source link

Sprues don't allow negative coordinates #336

Closed rnewton closed 3 years ago

rnewton commented 3 years ago

I'm trying to setup a sprue for PrintPlayGames card templates, but I'm not able to get a y-value that lines up with their template. You'll note that they have the cards rotated.

Using this as the sprue:

---
sheet_width: 12in
sheet_height: 18in
card_width: 2.5in
card_height: 3.5in
cards:
- x: 8.375in
  y: 0in

Results in

Screen Shot 2021-08-01 at 11 18 43 AM

If I rotate the card, it shifts down, indicating that the position_reference isn't lining up. Sprue:

---
sheet_width: 12in
sheet_height: 18in
card_width: 2.5in
card_height: 3.5in
cards:
- x: 8.375in
  y: 0in
  rotate: :clockwise

Results in

Screen Shot 2021-08-01 at 11 18 06 AM

As a workaround, I can probably set the position_reference to :center, but that's a little harder to reason about card placement. Would be nice if the rotation wasn't offset somehow for the :topleft or if I was allowed to set a negative position for x/y. If I do, I don't match the regex:

Squib::Sprues::InvalidSprueDefinition: Invalid sprue definition in file: src/layout/ppg-poker.yml. "cards"[0]["y"] is not a String matching /^(\d*[.])?\d+(in|cm|mm)$/
andymeneely commented 3 years ago

Fixed! Upgrade to v0.17.1 and you'll be able to get negative coordinates.

rnewton commented 3 years ago

Thanks, Andy!