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

Vite ice split draft #1127

Open
wants to merge 8 commits into
base: vite
Choose a base branch
from
Open

Vite ice split draft #1127

wants to merge 8 commits into from

Conversation

StempunkDev
Copy link
Contributor

Description

Aims to split the data from ice from the svg for ice into the pack

Type of change

  • Bug fix
  • New feature
  • Refactoring / style
  • Documentation update / chore
  • Other (please describe)

@@ -0,0 +1,18 @@

export interface IIceBase {
points: number[][];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TPoints is already defined

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to store transition:
dx: number; dy: number
Or better:
'transform': {x: number; y: number}

Can make it a global interface in the future (transform is used for a lot of things where user can drag elements)

@@ -0,0 +1,18 @@

export interface IIceBase {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to export in d.ts files. Or switch to always export for all files, it this case the filename should not be d.ts

points: number[][];
}

export interface Iiceberg extends IIceBase {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIceBerg to follow the other names pattern

}

export interface IiceShield extends IIceBase {
type: string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need type as it's in its own array

import * as d3 from "d3";

export function drawIce() {
const ice = d3.select("#ice");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use vanilla JS where possible (create whole html as string and then set to DOM via element.innerHTML as once), D3 adds significant memory burden while we don't use its real power anyway

transform: {x: number, y: number};
}

interface IiceBerg extends IIceBase {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be IIceBerg if we follow the same approach here

size: number;
}

interface IiceShield extends IIceBase {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -56,6 +56,10 @@ export function getGridPolygon(i: number): TPoints {
return grid.cells.v[i].map(v => grid.vertices.p[v]);
}

export function getGridPolygonWithGrid(i: number, cells: Pick<IGrid["cells"], "v">, vertices: IGraphVertices): TPoints {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit weird name and types. We can probably just pass grid

@StempunkDev StempunkDev marked this pull request as ready for review September 11, 2024 09:50
@StempunkDev
Copy link
Contributor Author

Breaks Ice Editor, I would edit that at a later point when the editors are migrated to ts

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

Successfully merging this pull request may close these issues.

2 participants