Kinrany / vue-p5

Vue component for p5.js
125 stars 16 forks source link

Element Drop Error: "g.File is not a constructor" #21

Closed darkwark closed 4 years ago

darkwark commented 5 years ago

Hello,

I'm trying to use p5.Element/drop. But once I drop the file into the canvas, I get the following error:

Uncaught TypeError: g.File is not a constructor
    at c (vue-p5.js?e25d:29)
    at d.Renderer2D.eval (vue-p5.js?e25d:29)

Here's the code I'm using:

setup(p5){
  let canvas = p5.createCanvas(500, 500)
  p5.background('#DDDDDD')

  canvas.drop(file => {
    this.img = p5.createImg(file.data, '').hide()
  })
},

draw(p5){
  let { img } = this

  if(img){
    p5.image(img, 0, 0, img.width, img.height)
  }
}
Kinrany commented 5 years ago

Hi, thanks for the report. p5@0.10.x merged p5.DOM into the main library, and vue-p5 is not using the latest version yet.

For now vue-p5@next can be used. It'll take a few days for me to update the examples and publish the changes in the main channel.

Kinrany commented 4 years ago

vue-p5@0.8.2 is out.

Took me a bit over 60 days, oh well :)