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

refactor(edgeless): use GfxElementGeometry interface #7758

Merged
merged 2 commits into from
Jul 30, 2024
Merged

Conversation

doodlewind
Copy link
Member

@doodlewind doodlewind commented Jul 29, 2024

This comes together with #7750. Before:

export class FrameBlockModel extends selectable<FrameBlockProps>(BlockModel) {
  override boxSelect(selectedBound: Bound): boolean {
    const bound = Bound.deserialize(this.xywh);
    return (
      bound.isIntersectWithBound(selectedBound) || selectedBound.contains(bound)
    );
  }

  override hitTest(x: number, y: number, _: ElementHitTestOptions): boolean {
    const bound = Bound.deserialize(this.xywh);
    const hit = bound.isPointNearBound([x, y], 5);

    if (hit) return true;

    return this.externalBound?.isPointInBound([x, y]) ?? false;
  }
}

After:

export class FrameBlockModel
  extends GfxCompatible<FrameBlockProps>(BlockModel)
  implements GfxElementGeometry
{
  override includesPoint(x: number, y: number, _: PointTestOptions): boolean {
    const bound = Bound.deserialize(this.xywh);
    const hit = bound.isPointNearBound([x, y], 5);

    if (hit) return true;

    return this.externalBound?.isPointInBound([x, y]) ?? false;
  }

  override intersectsBound(selectedBound: Bound): boolean {
    const bound = Bound.deserialize(this.xywh);
    return (
      bound.isIntersectWithBound(selectedBound) || selectedBound.contains(bound)
    );
  }
}
  • selectable -> GfxCompatible, we can switch to decorator in upcoming refactorings.

Copy link

vercel bot commented Jul 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2024 3:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 3:51pm

Copy link

graphite-app bot commented Jul 29, 2024

Your org has enabled the Graphite merge queue for merging into master

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind temporarily deployed to Playground E2E Test July 29, 2024 15:57 — with GitHub Actions Inactive
@doodlewind doodlewind marked this pull request as ready for review July 30, 2024 00:21
@doodlewind doodlewind merged commit 0f28a04 into master Jul 30, 2024
22 checks passed
@doodlewind doodlewind deleted the doodl_naming branch July 30, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant