From 0d7fb24b02f0f9f155b748fb235abc2534144fab Mon Sep 17 00:00:00 2001 From: Gabriel Csollei Date: Wed, 8 Jan 2025 04:48:17 +0000 Subject: [PATCH] Improve path2d --- workspaces/tools/deno.json | 2 +- workspaces/tools/src/path-2d.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/workspaces/tools/deno.json b/workspaces/tools/deno.json index 5c6fe58..b6c2139 100644 --- a/workspaces/tools/deno.json +++ b/workspaces/tools/deno.json @@ -1,5 +1,5 @@ { "name": "@g43/tools", - "version": "0.0.3", + "version": "0.0.5", "exports": "./src/index.ts" } diff --git a/workspaces/tools/src/path-2d.ts b/workspaces/tools/src/path-2d.ts index 37984d5..6e4edf0 100644 --- a/workspaces/tools/src/path-2d.ts +++ b/workspaces/tools/src/path-2d.ts @@ -7,11 +7,14 @@ export class Path2D { } } - public getFirstN(count: number): readonly ReadonlySimpleVector2[] { + public getFirstN(count: number): T[] { return this.points.slice(0, count); } + public getFrom(index: number): T[] { + return this.points.slice(index); + } - public getLastN(count: number): readonly ReadonlySimpleVector2[] { + public getLastN(count: number): T[] { return this.points.slice(this.points.length - count, this.points.length); }