Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Nuxt 3 using Fabric 6.4.2 moveTo() is either missing or there is an issue with my version of Fabric.js #10168

Closed
7 tasks done
jbiddulph opened this issue Sep 20, 2024 · 3 comments

Comments

@jbiddulph
Copy link

jbiddulph commented Sep 20, 2024

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

6.0.2

In What environments are you experiencing the problem?

Chrome

Node Version (if applicable)

None

Link To Reproduction

https://stackblitz.com/edit/nuxt-starter-m2eymn?file=pages%2Findex.vue

Steps To Reproduce

  1. Go to the link above, click add Square, click add Circle, great you can see these in my ordering list, click and drag, that should reorder the objects on the canvas by calling the moveTo method, but as it's false it doesn't work

In my nuxt 3 application:

onMounted(() => {
  const options = {
    backgroundColor: '#ffffff',
    selectionBorderColor: '#666666'
  };

  // Initialize Fabric.js canvas
  canvas = new fabric.Canvas(canvasEl.value, options);

  canvas.renderAll();
  if (canvas) {
    console.log('Canvas initialized:', canvas);
    // Add objects and other functionality
  }
  console.log("canvas.moveTo exists:", typeof canvas.moveTo === 'function');
  console.log("Canvas has sendBackwards:", typeof canvas.sendBackwards === "function");
  console.log("Canvas has bringForward:", typeof canvas.bringForward === "function");
});

in my console, I can see that Canvas is initialized but the next few lines are as follows:
canvas.moveTo exists: false
Canvas has sendBackwards: false
Canvas has bringForward: false

Expected Behavior

they should be true and the methods should be available for me to use but I am getting:

Actual Behavior

Uncaught (in promise) TypeError: canvas.moveTo is not a function

Error Message & Stack Trace

**Uncaught (in promise) TypeError: canvas.moveTo is not a function**
@gloriousjob
Copy link
Contributor

If you look here, moveTo was renamed to moveObjectTo. Can you try that?
#8299

@jbiddulph
Copy link
Author

jbiddulph commented Sep 22, 2024 via email

@asturur
Copy link
Member

asturur commented Sep 26, 2024

Those are gone as well, just set the backgroundImage or backgroundColor property.

@asturur asturur closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants