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

How to start custom crop option? #901

Open
TmVukov opened this issue Jan 14, 2024 · 1 comment
Open

How to start custom crop option? #901

TmVukov opened this issue Jan 14, 2024 · 1 comment
Labels

Comments

@TmVukov
Copy link

TmVukov commented Jan 14, 2024

Obviously, that option exists, but when i try to replicate it, i'm getting errors.

So i'm literally trying to implement this code from your "service-basic.js" file, which, as far as I can see, starts the custom crop mode:

$btnCrop.on('click', function () {
  imageEditor.startDrawingMode('CROPPER');
  $displayingSubMenu.hide();
  $displayingSubMenu = $cropSubMenu.show();
});

The example code in React would be something like this:

const handleCustomCrop = () => {
       if (editorRef.current) {
           const imageEditor = editorRef.current.getInstance()
           imageEditor.startDrawingMode('CROPPER')
       }
   }

This shows the plus icon to start cropping, but when I try to do that i get this error?

Cannot read properties of null (reading 'set')
TypeError: Cannot read properties of null (reading 'set')
at Cropper._onFabricMouseMove (http://localhost:3000/static/js/bundle.js:518311:24)
at klass.fire (http://localhost:3000/static/js/bundle.js:472426:60)
at klass._handleEvent (http://localhost:3000/static/js/bundle.js:484075:20)
at klass.__onMouseMove (http://localhost:3000/static/js/bundle.js:484338:20)
at klass._onMouseMove (http://localhost:3000/static/js/bundle.js:483922:20)

@nulifendou11
Copy link

遇到了同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants