create-definedmotion 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-definedmotion",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Create a new DefinedMotion animation project",
5
5
  "author": "Hugo Olsson",
6
6
  "license": "Apache-2.0",
@@ -399,6 +399,10 @@ export class AnimatedScene {
399
399
  const handleResize = (width: number) => {
400
400
  if (!width) return
401
401
 
402
+ if (this.isRendering) {
403
+ return
404
+ }
405
+
402
406
  // Respect the animation's logical aspect ratio
403
407
  const height = width / targetAspect
404
408
 
@@ -459,8 +463,13 @@ export class AnimatedScene {
459
463
  this.isRendering = true
460
464
  this.isPlaying = true
461
465
  this.stopControls()
466
+
467
+ const ro = this.resizeObserver
468
+ ro?.disconnect()
469
+
462
470
  const renderName = generateID(10)
463
471
 
472
+
464
473
  const cpu_free_time = 5
465
474
  const div = this.container
466
475
  const originalPosition = div.style.position
@@ -513,6 +522,8 @@ export class AnimatedScene {
513
522
  div.style.zIndex = originalZIndex
514
523
 
515
524
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight)
525
+ ro?.observe(this.container)
526
+
516
527
  this.isPlaying = false
517
528
  await this.jumpToFrameAtIndex(0)
518
529
  this.renderCurrentFrame()