Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ KiCanvas is very early in its development and there's a ton of stuff that hasn't

## Known issues

In general, please check the [GitHub issues] page before filing new issues. Some high-level things that we known won't work:
In general, please check the [GitHub issues] page before filing new issues. Some high-level things that we know won't work:

- Any KiCAD 5 files, KiCanvas can only parse files from KiCAD 6 and later.
- Some KiCAD 7 features might not be fully implemented, such as custom fonts in schematics.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ derivative works.

This project contains copies or makes use of other works. These works and their respective license and terms are:

- Earcut by Mapbox, licensed under the ISC license. Retrived from https://github.com/mapbox/earcut.
- Earcut by Mapbox, licensed under the ISC license. Retrieved from https://github.com/mapbox/earcut.
- Newstroke by Vladimir Uryvaev, Lingdong Huang, Adobe, and KiCAD contributors. Originally licensed under Creative Commons CC0 1.0, amended with an MIT-like license, and utilizes glyphs that are licensed under the SIL Open Font License Version 1.1.
- Material Symbols by Google, licensed under the Apache License, Version 2.0. Retrieved from https://github.com/google/material-design-icons.
- Nunito by Vernon Adams, Manvel Shmavonyan, licensed under the Open Font License. Retrieved from https://fonts.google.com/specimen/Nunito/about
Expand Down
2 changes: 1 addition & 1 deletion src/base/dom/size-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { IDisposable } from "../disposable";
type ResizeObserverCallback = (target: HTMLElement) => void;

/**
* Wrapper over ResizeObserver that implmenets IDisposable
* Wrapper over ResizeObserver that implements IDisposable
*/
export class SizeObserver implements IDisposable {
#observer: ResizeObserver;
Expand Down
2 changes: 1 addition & 1 deletion src/base/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type { IDisposable } from "./disposable";

/**
* Adds an event listener and wraps it as a Disposable. When disposed, the
* Adds an event listener and wraps it as a Disposable. When disposed of, the
* event listener is removed from the target.
*/
export function listen<K extends keyof GlobalEventHandlersEventMap>(
Expand Down
2 changes: 1 addition & 1 deletion src/base/math/angle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Angle {
}

/**
* Returns a new Angle representing the different of this angle and the given angle.
* Returns a new Angle representing the difference between this angle and the given angle.
*/
sub(other: AngleLike) {
const diff = this.radians - new Angle(other).radians;
Expand Down
6 changes: 3 additions & 3 deletions src/base/math/arc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class Arc {
const mid_angle = mid.sub(center).angle;
const end_angle = end.sub(center).angle;

// calcuate the arc angle
// calculate the arc angle
let arc_angle;
const start_to_mid = mid_angle.sub(start_angle).normalize();
const start_to_end = end_angle.sub(start_angle).normalize();
Expand All @@ -60,8 +60,8 @@ export class Arc {
arc_angle = Angle.from_degrees(360).sub(start_to_end);
}

// although kicad always create a clockwise arc,
// but we can import a counter-clockwise arc from other EDA/CAD using KiCad
// although KiCad always creates clockwise arcs, the file may contain
// counter-clockwise arcs through imports from other EDA/CAD programs
let arc_start;
let direction: ArcDirection;

Expand Down
2 changes: 1 addition & 1 deletion src/base/math/bbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class BBox {
}

/**
* @returns true if the bbox has a non-zero area
* @returns true if the BBox has a non-zero area
*/
get valid() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/base/math/camera2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class Camera2 {
}

/**
* Apply this camera to a 2d canvas
* Apply this camera to a 2D canvas
*
* A simple convenience method that sets the canvas's transform to
* the camera's transformation matrix.
Expand Down
10 changes: 5 additions & 5 deletions src/base/math/matrix3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Matrix3 {
}

/**
* @returns a new matrix representing a 2d orthographic projection
* @returns a new matrix representing a 2D orthographic projection
*/
static orthographic(width: number, height: number): Matrix3 {
// prettier-ignore
Expand Down Expand Up @@ -147,7 +147,7 @@ export class Matrix3 {
}

/**
* Transforms a list of vector by a given matrix, which may be null.
* Transforms a list of vectors by a given matrix, which may be null.
*/
static transform_all(mat: Matrix3 | null, vecs: Vec2[]): Vec2[] {
if (!mat) {
Expand Down Expand Up @@ -237,7 +237,7 @@ export class Matrix3 {
}

/**
* @returns A new matrix representing a 2d translation
* @returns A new matrix representing a 2D translation
*/
static translation(x: number, y: number): Matrix3 {
// prettier-ignore
Expand Down Expand Up @@ -265,7 +265,7 @@ export class Matrix3 {
}

/**
* @returns {Matrix3} A new matrix representing a 2d scale
* @returns {Matrix3} A new matrix representing a 2D scale
*/
static scaling(x: number, y: number): Matrix3 {
// prettier-ignore
Expand Down Expand Up @@ -293,7 +293,7 @@ export class Matrix3 {
}

/**
* @returns A new matrix representing a 2d rotation
* @returns A new matrix representing a 2D rotation
*/
static rotation(angle: AngleLike): Matrix3 {
const theta = new Angle(angle).radians;
Expand Down
4 changes: 2 additions & 2 deletions src/base/web-components/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const default_attribute_converter = {
return `${value}`;
default:
throw new Error(
`Can not convert type "${type}" and value "${value} to attribute`,
`Cannot convert type "${type}" and value "${value} to attribute`,
);
}
},
Expand All @@ -81,7 +81,7 @@ const default_attribute_converter = {
return value === null ? null : Number(value);
default:
throw new Error(
`Can not convert type "${type}" and value "${value} to attribute`,
`Cannot convert type "${type}" and value "${value} to attribute`,
);
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/base/web-components/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function prepare_template_html(
}

/**
* Walks through the give DOM tree and replaces placeholders with values.
* Walks through the given DOM tree and replaces placeholders with values.
*/
function apply_values_to_tree(tree: DocumentFragment, values: unknown[]) {
const walker = document.createTreeWalker(
Expand Down Expand Up @@ -143,11 +143,11 @@ function apply_content_value(node: Node | null, text: Text, values: unknown[]) {
if (!part) {
continue;
}
// Even parts are text nodes.
// Even numbered parts are text nodes.
if (i % 2 == 0) {
node.insertBefore(new Text(part), text);
}
// Odd parts are placeholders.
// Odd numbered parts are placeholders.
else {
for (const value of convert_value_for_content(
values[parseInt(part, 10)],
Expand All @@ -158,7 +158,7 @@ function apply_content_value(node: Node | null, text: Text, values: unknown[]) {
}
}

// clear the text data instead of removing the node, since removing it will
// Clear the text data instead of removing the node, since removing it will
// break the tree walker.
text.data = "";
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export abstract class Renderer implements IDisposable {
/**
* Finish a layer of graphics.
*
* Performs any additional work needed such as tesselation and buffer
* Performs any additional work needed such as tessellation and buffer
* management.
*/
abstract end_layer(): RenderLayer;
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/webgl/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class WebGL2Renderer extends Renderer {
override clear_canvas() {
if (this.gl == null) throw new Error("Uninitialized");

// Upate canvas size and projection matrix if needed
// Update canvas size and projection matrix if needed
this.update_canvas_size();

this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
Expand Down
18 changes: 9 additions & 9 deletions src/graphics/webgl/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Low-level library for efficiently rendering sets of basic geometric
* primitives using WebGL. Think of it as a really hard to use version
* primitives using WebGL. Think of it as a really hard-to-use version
* of SVG. This is the underlying code used by WebGL2Renderer to actually
* turn abstract primitives into WebGL stuff.
*
Expand All @@ -16,7 +16,7 @@
* The core principle here is primitive sets. These sets collect all the data
* necessary to render *multiple* primitives. Primitive sets are write-once.
* Call set() with a list of primitive objects to tesselate them and upload
* their data to the GPU. Use draw() to have the GPU render the tesselated
* their data to the GPU. Use draw() to have the GPU render the tessellated
* geometry. Use dispose() to free GPU resources.
*
*/
Expand Down Expand Up @@ -156,7 +156,7 @@ class Tesselator {
}

/**
* Tesselate a circle into a quad
* Tessellate a circle into a quad
* @returns four points representing the quad
*/
static tesselate_circle(circle: Circle): [Vec2, Vec2, Vec2, Vec2] {
Expand All @@ -172,7 +172,7 @@ class Tesselator {
}

/**
* Tesselate an array of circles into renderable data
* Tessellate an array of circles into renderable data
*/
static tesselate_circles(circles: Circle[]) {
const vertex_count = circles.length * this.vertices_per_quad;
Expand Down Expand Up @@ -377,7 +377,7 @@ export class PolylineSet implements IDisposable {
}

/**
* Tesselate an array of polylines and upload them to the GPU.
* Tessellate an array of polylines and upload them to the GPU.
*/
set(lines: Polyline[]) {
if (!lines.length) {
Expand Down Expand Up @@ -477,7 +477,7 @@ export class PolygonSet implements IDisposable {
/**
* Convert an array of triangle vertices to polylines.
*
* This is a helper function for debugging. It allows easily drawing the
* This is a helper function for debugging. It allows for easy drawing of the
* outlines of the results of triangulation.
*
*/
Expand All @@ -497,7 +497,7 @@ export class PolygonSet implements IDisposable {
}

/**
* Tesselate (triangulate) and upload a list of polygons to the GPU.
* Tessellate (triangulate) and upload a list of polygons to the GPU.
*/
set(polygons: Polygon[]) {
let total_vertex_data_length = 0;
Expand Down Expand Up @@ -555,7 +555,7 @@ export class PolygonSet implements IDisposable {
* GPU, and draw them together. This is conceptually a "layer", all primitives
* are drawn at the same depth.
*
* Like the underlying primitive sets, this is intended to be write once. Once
* Like the underlying primitive sets, this is intended to be written to once. Once
* you call commit() the primitive data is released from working RAM and exists
* only in the GPU buffers. To modify the data, you'd dispose() of this layer
* and create a new one.
Expand Down Expand Up @@ -636,7 +636,7 @@ export class PrimitiveSet implements IDisposable {
}

/**
* Tesselate all collected primitives and upload their data to the GPU.
* Tessellate all collected primitives and upload their data to the GPU.
*/
commit() {
if (this.#polygons.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/kicad/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ export class SymbolProperty implements HasUniqueID {
}
}

/** Base class for Line, Circle, and others which has 'stroke' property. */
/** Base class for Line, Circle, and others which have 'stroke' property. */
class GraphicItem implements HasUniqueID, HasStrokeParams {
parent?: Footprint | KicadPCB;
layer: string;
Expand Down
2 changes: 1 addition & 1 deletion src/kicad/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export interface HasStrokeParams {
get stroke_params(): StrokeParams;
}

/** Items which has netname */
/** Items which have a netname */
export interface HasNetName {
get netname(): string | undefined;
}
10 changes: 5 additions & 5 deletions src/kicad/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const T = {
return new Color(el[1] / 255, el[2] / 255, el[3] / 255, el[4]);
},
/**
* Choice one type processor by prefix
* Choose a type processor by prefix
*
* Example: `choice[("xy", T.vec2), ("color", T.color)]`
* - if input is `(xy 1 2)`, use `T.vec2` to parse input
Expand Down Expand Up @@ -310,7 +310,7 @@ export const P = {
return P.expr(name, T.item(item_type, ...args));
},
/**
* Accepts an expression that describes a 2d vector. For example,
* Accepts an expression that describes a 2D vector. For example,
* ((xy 1 2)) with vec2("xy") would end up with {xy: Vec2(1, 2)}.
*/
vec2(name: string) {
Expand Down Expand Up @@ -356,7 +356,7 @@ export function parse_expr(expr: string | List, ...defs: PropertyDefinition[]) {

if (!acceptable_start_strings.includes(first)) {
throw new Error(
`Expression must start with ${start_def.name} found ${first} in ${expr}`,
`Expression must start with ${start_def.name}, but found ${first} in ${expr}`,
);
}

Expand All @@ -380,7 +380,7 @@ export function parse_expr(expr: string | List, ...defs: PropertyDefinition[]) {

if (!def) {
log.warn(
`no def for bare element ${element} at position ${n} in expression ${expr}`,
`Bare element ${element} is undefined at position ${n} in expression ${expr}`,
);
continue;
}
Expand All @@ -395,7 +395,7 @@ export function parse_expr(expr: string | List, ...defs: PropertyDefinition[]) {

if (!def) {
log.warn(
`No def found for element ${element} in expression ${expr}`,
`No definition found for element ${element} in expression ${expr}`,
);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/kicad/text/font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export abstract class Font {

/** Breaks text up into words, accounting for markup.
*
* Corresponds to KiCAD's FONT::workbreakMarkup
* Corresponds to KiCAD's FONT::wordbreakMarkup
*
* As per KiCAD, a word can represent an actual word or a run of text
* with subscript, superscript, or overbar applied.
Expand Down
2 changes: 1 addition & 1 deletion src/kicad/text/glyph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Angle, BBox, Vec2 } from "../../base/math";
/**
* Glyph abstract base class
*
* Shared between stroke and outline fonts, altough outline fonts aren't
* Shared between stroke and outline fonts, although outline fonts aren't
* currently implemented.
*/
export abstract class Glyph {
Expand Down
6 changes: 3 additions & 3 deletions src/kicad/text/lib-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class LibText extends EDAText {

/**
* Internal utility method for offsetting the text position based on the
* horizontal and vertical justifcation.
* horizontal and vertical justification.
*/
normalize_justification(inverse: boolean) {
let delta = new Vec2(0, 0);
Expand Down Expand Up @@ -193,7 +193,7 @@ export class LibText extends EDAText {
/**
* Mirrors the text horizontally.
*
* Deals with re-assigning the horizontal justification, as mirroring
* Deals with reassigning the horizontal justification, as mirroring
* left aligned text is the same as changing it to right aligned.
*/
mirror_horizontally(center: Vec2) {
Expand All @@ -217,7 +217,7 @@ export class LibText extends EDAText {
/**
* Mirrors the text vertically.
*
* Deals with re-assigning the vertical justification, as mirroring
* Deals with reassigning the vertical justification, as mirroring
* top aligned text is the same as changing it to bottom aligned.
*/
mirror_vertically(center: Vec2) {
Expand Down
Loading