@@ -26,6 +26,7 @@ import { useNotifyStore } from './notifications'
26
26
import { createUseStore , storePicker } from '@/utils/zustand'
27
27
import { shallowEquals } from '@paplico/shared-lib'
28
28
import debounce from 'just-debounce'
29
+ import { rescue } from '@hanakla/arma'
29
30
30
31
interface EngineStore {
31
32
_engine : Paplico | null
@@ -87,11 +88,12 @@ export function usePaplicoInit(
87
88
// colorSpace: 'display-p3',
88
89
} )
89
90
91
+ console . log ( pplc )
90
92
; ( window as any ) . pplc = pplc
91
93
pplc . exposeLogChannelToGlobalThis ( )
92
94
93
95
await pplc . brushes . register ( ExtraBrushes . ScatterBrush )
94
- await pplc . fonts . requestToRegisterLocalFonts ( )
96
+ await rescue ( ( ) => pplc . fonts . requestToRegisterLocalFonts ( ) )
95
97
96
98
pplc . on ( 'stateChanged' , ( ) => {
97
99
engineStore . _setEngineState ( pplc . state )
@@ -136,11 +138,11 @@ export function usePaplicoInit(
136
138
137
139
// Canvas editor event
138
140
useDangerouslyEffectAsync ( ( ) => {
139
- const handler = engineStore . canvasEditor
140
- if ( ! handler ) return
141
+ const canvasEditor = engineStore . canvasEditor
142
+ if ( ! canvasEditor ) return
141
143
142
144
const offs = [
143
- handler . on ( 'toolModeChanged' , ( { next } ) => {
145
+ canvasEditor . on ( 'toolModeChanged' , ( { next } ) => {
144
146
notifyStore . emit ( { type : 'toolChanged' , tool : next } )
145
147
} ) ,
146
148
]
0 commit comments