replicate/scribble-diffusion

Use a new canvas implementation

Closed this issue ยท 5 comments

zeke commented

The existing react-sketch-canvas package that's currently used has a number of issues:

There are probably a lot of alternative npm packages out there that do the same thing, but better. Here are some that might be useful:

zeke commented

I would love help from the community on this one!

It seems that this is the problem with a mask. I'm not familiar with react, nor with that one lib, but digging briefly through the code, it seems that the mask is used with eraser function.

Since you don't have an erasing element on your canvas, but "Undo" button instead, you could remove mask attribute from #react-sketch-canvas element to show whole canvas without that mask. For me it solves the problem on Firefox.

vokoscreenNG-2023-03-02_06-32-33.mp4

This Greasemonkey script serves as a workaround on a client's side, but if added serverside, it can temporary solve the problem till the full-fledged fix :P

  // ==UserScript==
  // @name scribblediffusion canvas temp fix
  // @description Removes mask attr from canvas element for proper view in firefox
  // @match https://scribblediffusion.com/
  // @version   1.0.0
  // ==/UserScript==

  window.addEventListener('load', function () {
      var canvas_with_mask = document.querySelector("#react-sketch-canvas__stroke-group-0");
      canvas_with_mask.removeAttribute("mask");
  })

I can verify that the script @scsmash3r gave fixes the issue.

zeke commented

Nice work! Thanks for your help on this.

https://twitter.com/zeke/status/1631507015863517184