davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.04k stars 174 forks source link

Error when using viewport 'snap': TypeError: Penner__default.default is undefined #331

Open xbgbtx opened 3 years ago

xbgbtx commented 3 years ago

I get the following when I use the 'snap' funcion.

Uncaught (in promise) TypeError: Penner__default.default is undefined
    ease http://localhost:1337/L-Systems/lib/external/pixi-plugin/viewport.min.js:126
    Snap http://localhost:1337/L-Systems/lib/external/pixi-plugin/viewport.min.js:2709
    snap http://localhost:1337/L-Systems/lib/external/pixi-plugin/viewport.min.js:5028
    create_viewport http://localhost:1337/L-Systems/lib/pixi_app.js:57
    page_loaded http://localhost:1337/L-Systems/lib/main.js:8
    onload http://localhost:1337/L-Systems/:1
viewport.min.js:126:13

Something not initialized in these lines?

https://github.com/xbgbtx/L-Systems/blob/88e4d4b753da8c94fce6610375a86cee5290e8bb/lib/external/pixi-plugin/viewport.min.js#L19-L21

    function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

    var Penner__default = /*#__PURE__*/_interopDefaultLegacy(Penner);

Am I missing a plugin for these Penner functions?

xbgbtx commented 3 years ago

This is my project: https://github.com/xbgbtx/L-Systems

I am including the viewport lib using html script tags with the latest github release.

Initializing pixi / viewport is done here: https://github.com/xbgbtx/L-Systems/blob/88e4d4b753da8c94fce6610375a86cee5290e8bb/lib/pixi_app.js#L5-L59

Using:

bollogo commented 3 years ago

Including penner.js from https://github.com/bcherny/penner worked for me. Just make sure that Penner (with capital P) is defined globally (the library defines it as window.penner) So you might need to rename the variable.

Hope that helps.