-
-
Notifications
You must be signed in to change notification settings - Fork 679
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
base: vite
Are you sure you want to change the base?
Vite ice split draft #1127
Conversation
src/types/pack/ice.d.ts
Outdated
@@ -0,0 +1,18 @@ | |||
|
|||
export interface IIceBase { | |||
points: number[][]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TPoints
is already defined
There was a problem hiding this comment.
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)
src/types/pack/ice.d.ts
Outdated
@@ -0,0 +1,18 @@ | |||
|
|||
export interface IIceBase { |
There was a problem hiding this comment.
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
src/types/pack/ice.d.ts
Outdated
points: number[][]; | ||
} | ||
|
||
export interface Iiceberg extends IIceBase { |
There was a problem hiding this comment.
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
src/types/pack/ice.d.ts
Outdated
} | ||
|
||
export interface IiceShield extends IIceBase { | ||
type: string; |
There was a problem hiding this comment.
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
src/layers/renderers/drawIce.ts
Outdated
import * as d3 from "d3"; | ||
|
||
export function drawIce() { | ||
const ice = d3.select("#ice"); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
src/utils/graphUtils.ts
Outdated
@@ -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 { |
There was a problem hiding this comment.
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
Breaks Ice Editor, I would edit that at a later point when the editors are migrated to ts |
Description
Aims to split the data from ice from the svg for ice into the pack
Type of change