Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
OrionReed committed Dec 1, 2024
1 parent c4a61f8 commit 62454dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions demo/distance.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
position: absolute;
}

cell-renderer canvas {
distance-field canvas {
position: absolute;
top: 0;
left: 0;
Expand All @@ -31,22 +31,22 @@
</style>
</head>
<body>
<cell-renderer resolution="800" image-smoothing="true">
<distance-field>
<fc-geometry x="100" y="100" width="50" height="50"></fc-geometry>
<fc-geometry x="100" y="200" width="50" height="50"></fc-geometry>
<fc-geometry x="100" y="300" width="50" height="50"></fc-geometry>
<fc-geometry x="300" y="150" width="80" height="40"></fc-geometry>
<fc-geometry x="400" y="250" width="60" height="90"></fc-geometry>
<fc-geometry x="200" y="400" width="100" height="100"></fc-geometry>
<fc-geometry x="500" y="100" width="30" height="70"></fc-geometry>
</cell-renderer>
</distance-field>

<script type="module">
import { FolkGeometry } from '../src/canvas/fc-geometry.ts';
import { CellRenderer } from '../src/distanceField/cellRenderer.ts';
import { DistanceField } from '../src/distanceField/distance-field.ts';

FolkGeometry.define();
CellRenderer.define();
DistanceField.define();
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import type { FolkGeometry } from '../canvas/fc-geometry.ts';
import type { Vector2 } from '../utils/Vector2.ts';
import { Fields } from './fields.ts';

export class CellRenderer extends HTMLElement {
static tagName = 'cell-renderer';
export class DistanceField extends HTMLElement {
static tagName = 'distance-field';

static define() {
customElements.define(this.tagName, this);
}

static observedAttributes = ['resolution', 'image-smoothing'];

private canvas: HTMLCanvasElement;
private canvas!: HTMLCanvasElement;
private ctx: CanvasRenderingContext2D;
private offscreenCtx: CanvasRenderingContext2D;
private fields: Fields;
Expand All @@ -24,7 +22,7 @@ export class CellRenderer extends HTMLElement {
constructor() {
super();

this.resolution = 2000; // default resolution
this.resolution = 800; // default resolution
this.imageSmoothing = true;
this.fields = new Fields(this.resolution);

Expand Down

0 comments on commit 62454dc

Please sign in to comment.