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

change: GraphicsGroup no longer centers with anchors #2966

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

eonarheim
Copy link
Member

@eonarheim eonarheim commented Mar 14, 2024

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

useAnchor: false The graphics members are positioned from the top left

const graphicGroup = new ex.GraphicsGroup({
  useAnchor: false,
  members: [
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(0, 0),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(0, 16),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(16, 16),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(16, 0),
    },
  ],
});

image

useAnchor: true The graphics members' total combined bounds are centered by the actor's anchor (.5, .5) by default

const graphicGroup = new ex.GraphicsGroup({
  useAnchor: true,
  members: [
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(0, 0),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(0, 16),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(16, 16),
    },
    {
      graphic: heartImage.toSprite(),
      offset: ex.vec(16, 0),
    },
  ],
});

image

@github-actions github-actions bot added the enhancement Label applied to enhancements or improvements to existing features label Mar 14, 2024
Copy link

cloudflare-workers-and-pages bot commented Mar 14, 2024

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b0e026c
Status: ✅  Deploy successful!
Preview URL: https://9c4bea39.excaliburjs.pages.dev
Branch Preview URL: https://feat-tweak-graphics-groups.excaliburjs.pages.dev

View logs

@eonarheim eonarheim merged commit 99c7a88 into main Mar 26, 2024
5 of 6 checks passed
@eonarheim eonarheim deleted the feat/tweak-graphics-groups branch March 26, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Label applied to enhancements or improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant