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

[Feature]: Support line dashes for the aligning guidelines extension #10393

Open
4 tasks done
stevenhurth opened this issue Jan 8, 2025 · 1 comment
Open
4 tasks done

Comments

@stevenhurth
Copy link

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have searched and referenced existing issues, feature requests and discussions
  • I am filing a FEATURE request.

Description

We recently discovered the v6 aligning guidelines extension, and I was hoping that support for a line dash could be configured for the guidelines.

Currently, we have our own extension, that does a lot of the same work as the supported one, and we'd like to eliminate some technical debt by switching over to the supported version.

Current State

Currently, with the supported extension, all guidelines are drawn solid.

Additional Context

With our custom extension, the guidelines are drawn with dashes, and < > symbols for the sign on the line caps.
image

private drawLine = (ctx: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number) => {
    const point1 = new Point(x1, y1);
    const point2 = new Point(x2, y2);
    const zoom = this.canvas.getZoom();
    const { aligningLineColor: color, aligningLineWidth: width, lineDashArray } = this.options;

    ctx.save();
    ctx.transform(...this.canvas.viewportTransform);
    ctx.lineWidth = width / zoom;
    ctx.strokeStyle = color;
    // Draw the line with dashes, if specified.
    if (lineDashArray) {
      ctx.setLineDash(lineDashArray);
    }
    ctx.beginPath();

    ctx.moveTo(point1.x, point1.y);
    ctx.lineTo(point2.x, point2.y);
    ctx.stroke();

    this.drawLineCaps(ctx, zoom, point1, point2);

    ctx.restore();
};
@zhe-he
Copy link
Contributor

zhe-he commented Jan 13, 2025

Resolved.
#10120

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

No branches or pull requests

2 participants