@tileflow/core 0.1.0-alpha.30 → 0.1.0-alpha.32

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/capture.js CHANGED
@@ -204,8 +204,19 @@ var tileflowCaptureSceneSchema = z3.object({
204
204
  viewport: tileflowCaptureViewportSchema,
205
205
  target: tileflowCaptureTargetSchema.optional()
206
206
  }).strict();
207
+ function tileflowCaptureSceneFitIssue(scene) {
208
+ if (scene.camera.type !== "bounds" || scene.camera.padding === void 0) return void 0;
209
+ const room = Math.min(scene.viewport.width, scene.viewport.height);
210
+ if (scene.camera.padding * 2 < room) return void 0;
211
+ return {
212
+ message: `Expected bounds padding less than half the viewport's shorter side (${room / 2} pixels)`,
213
+ path: ["camera", "padding"]
214
+ };
215
+ }
207
216
  function normalizeTileflowCaptureScene(input) {
208
217
  const scene = tileflowCaptureSceneSchema.parse(input);
218
+ const fit = tileflowCaptureSceneFitIssue(scene);
219
+ if (fit) throw new RangeError(`${fit.path.join(".")}: ${fit.message}`);
209
220
  const camera = scene.camera.type === "center" ? {
210
221
  type: scene.camera.type,
211
222
  center: scene.camera.center,
@@ -265,6 +276,7 @@ export {
265
276
  tileflowCaptureCenterCameraSchema,
266
277
  tileflowCaptureIdSchema,
267
278
  tileflowCaptureMapTargetSchema,
279
+ tileflowCaptureSceneFitIssue,
268
280
  tileflowCaptureSceneLimits,
269
281
  tileflowCaptureSceneNameSchema,
270
282
  tileflowCaptureSceneSchema,