@@ -262,7 +262,7 @@ let requestedAnimationFrame;
262262
263263 this .setInitialEngineProps ();
264264 this .updateLogoWidth ();
265- this .draw ().catch (console . debug );
265+ this .draw ().catch (this . logDebugError );
266266 });
267267 },
268268
@@ -272,6 +272,12 @@ let requestedAnimationFrame;
272272 },
273273
274274 methods: {
275+ logDebugError (error ) {
276+ if (! process .env .NODE_ENV || process .env .NODE_ENV === ' development' ) {
277+ console .debug (error);
278+ }
279+ },
280+
275281 setInitialEngineProps () {
276282 const engine = this .engine ;
277283
@@ -330,8 +336,12 @@ let requestedAnimationFrame;
330336
331337 if (requestedAnimationFrame) {
332338 window .cancelAnimationFrame (requestedAnimationFrame);
333- this .drawPromises .get (requestedAnimationFrame)? .reject (new Error (' Repaint cancelled.' ));
334- this .drawPromises .delete (requestedAnimationFrame);
339+ // Only reject if it's not a repaint cancellation
340+ const promise = this .drawPromises .get (requestedAnimationFrame);
341+ if (promise) {
342+ promise .reject (new Error (' Repaint cancelled' ));
343+ this .drawPromises .delete (requestedAnimationFrame);
344+ }
335345 }
336346
337347 const drawFn = (resolve ) => {
@@ -527,102 +537,102 @@ let requestedAnimationFrame;
527537 watch: {
528538 logoImage (value ) {
529539 this .engine .logoImage = value;
530- this .draw ().catch (console . debug );
540+ this .draw ().catch (this . logDebugError );
531541 },
532542 logoType (value ) {
533543 this .engine .logoType = value;
534544 this .updateLogoWidth ();
535- this .draw ().catch (console . debug );
545+ this .draw ().catch (this . logDebugError );
536546 },
537547 styleSet (value ) {
538548 this .engine .styleSet = value;
539- this .draw ().catch (console . debug );
549+ this .draw ().catch (this . logDebugError );
540550 },
541551 format (value ) {
542552 this .engine .format = value;
543- this .draw (true ).catch (console . debug );
553+ this .draw (true ).catch (this . logDebugError );
544554 },
545555 visibleHeight (value ) {
546556 this .engine .bleed = this .bleed ;
547557 this .engine .visibleHeight = value;
548558 this .updateLogoWidth ();
549- this .draw ().catch (console . debug );
559+ this .draw ().catch (this . logDebugError );
550560 },
551561 visibleWidth (value ) {
552562 this .engine .bleed = this .bleed ;
553563 this .engine .visibleWidth = value;
554564 this .updateLogoWidth ();
555- this .draw ().catch (console . debug );
565+ this .draw ().catch (this . logDebugError );
556566 },
557567 canvasHeight (value ) {
558568 this .canvas .height = value;
559- this .draw (true ).catch (console . debug );
569+ this .draw (true ).catch (this . logDebugError );
560570 },
561571 canvasWidth (value ) {
562572 this .canvas .width = value;
563- this .draw (true ).catch (console . debug );
573+ this .draw (true ).catch (this . logDebugError );
564574 },
565575 backgroundType (value ) {
566576 this .engine .backgroundType = value;
567- this .draw ().catch (console . debug );
577+ this .draw ().catch (this . logDebugError );
568578 },
569579 backgroundImage (value ) {
570580 this .engine .backgroundImage = value;
571- this .draw ().catch (console . debug );
581+ this .draw ().catch (this . logDebugError );
572582 },
573583 backgroundZoom (value ) {
574584 this .engine .backgroundZoom = value;
575- this .draw ().catch (console . debug );
585+ this .draw ().catch (this . logDebugError );
576586 },
577587 backgroundWatermarkText (value ) {
578588 this .engine .backgroundWatermarkText = value;
579- this .draw ().catch (console . debug );
589+ this .draw ().catch (this . logDebugError );
580590 },
581591 bars (value ) {
582592 this .engine .bars = value;
583- this .draw (true ).catch (console . debug );
593+ this .draw (true ).catch (this . logDebugError );
584594 },
585595 fontSizePercent (value ) {
586596 this .engine .fontSizePercent = value;
587- this .draw ().catch (console . debug );
597+ this .draw ().catch (this . logDebugError );
588598 },
589599 hasTopShadow (value ) {
590600 this .engine .topShadow = value;
591- this .draw ().catch (console . debug );
601+ this .draw ().catch (this . logDebugError );
592602 },
593603 hasBottomShadow (value ) {
594604 this .engine .bottomShadow = value;
595- this .draw ().catch (console . debug );
605+ this .draw ().catch (this . logDebugError );
596606 },
597607 hasBorder (value ) {
598608 this .engine .hasBorder = value;
599- this .draw ().catch (console . debug );
609+ this .draw ().catch (this . logDebugError );
600610 },
601611 copyrightText () {
602612 this .setCopyrightText ();
603- this .draw ().catch (console . debug );
613+ this .draw ().catch (this . logDebugError );
604614 },
605615 alignment (value ) {
606616 this .engine .alignment = value;
607- this .draw ().catch (console . debug );
617+ this .draw ().catch (this . logDebugError );
608618 },
609619 fontsLoaded () {
610- this .draw (true ).catch (console . debug );
620+ this .draw (true ).catch (this . logDebugError );
611621 },
612622 mousePos () {
613623 this .engine .mousePos = this .mousePos ;
614- this .draw ().catch (console . debug );
624+ this .draw ().catch (this . logDebugError );
615625 },
616626 dragging () {
617627 this .engine .dragging = this .dragging ;
618- this .draw ().catch (console . debug );
628+ this .draw ().catch (this . logDebugError );
619629 },
620630 previewDims (value ) {
621631 this .engine .previewDims = value;
622632 },
623633 bleed (value ) {
624634 this .engine .bleed = value;
625- this .draw ().catch (console . debug );
635+ this .draw ().catch (this . logDebugError );
626636 },
627637 }
628638 }
0 commit comments