@fieldnotes/core 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -220,6 +220,7 @@ var Camera = class {
220
220
  };
221
221
 
222
222
  // src/canvas/background.ts
223
+ var MIN_PATTERN_SPACING = 16;
223
224
  var DEFAULTS = {
224
225
  pattern: "dots",
225
226
  spacing: 24,
@@ -255,8 +256,15 @@ var Background = class {
255
256
  }
256
257
  ctx.restore();
257
258
  }
259
+ adaptSpacing(baseSpacing, zoom) {
260
+ let spacing = baseSpacing * zoom;
261
+ while (spacing < MIN_PATTERN_SPACING) {
262
+ spacing *= 2;
263
+ }
264
+ return spacing;
265
+ }
258
266
  renderDots(ctx, camera, width, height) {
259
- const spacing = this.spacing * camera.zoom;
267
+ const spacing = this.adaptSpacing(this.spacing, camera.zoom);
260
268
  const offsetX = camera.position.x % spacing;
261
269
  const offsetY = camera.position.y % spacing;
262
270
  const radius = this.dotRadius * Math.min(camera.zoom, 2);
@@ -271,7 +279,7 @@ var Background = class {
271
279
  ctx.fill();
272
280
  }
273
281
  renderGrid(ctx, camera, width, height) {
274
- const spacing = this.spacing * camera.zoom;
282
+ const spacing = this.adaptSpacing(this.spacing, camera.zoom);
275
283
  const offsetX = camera.position.x % spacing;
276
284
  const offsetY = camera.position.y % spacing;
277
285
  const lineW = this.lineWidth * Math.min(camera.zoom, 2);
@@ -2212,7 +2220,7 @@ var ImageTool = class {
2212
2220
  };
2213
2221
 
2214
2222
  // src/index.ts
2215
- var VERSION = "0.1.0";
2223
+ var VERSION = "0.1.2";
2216
2224
  // Annotate the CommonJS export names for ESM import in node:
2217
2225
  0 && (module.exports = {
2218
2226
  AddElementCommand,