Skip to content

Check if cropper is dirty #199

Answered by Norserium
lucianobosco asked this question in Q&A
Discussion options

You must be logged in to vote

@lucianobosco, I can offer you to use @ready event, save the initial state as the default state and compare the current state with one. The example.

In the new core it will be pretty easy, you can easily retrieve default state and compare it with the current state:

import { isEqualStates } from 'advanced-cropper/service'
const cropper = cropperRef.value;

if (cropper) {
   const state = cropper.getState();
   const image = cropper.getImage();
   if (state && image) {
      isEqualStates(state, cropper.getDefaultState(state.boundary, image));
   }
  return true;
}

But currently it's not available.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lucianobosco
Comment options

@Norserium
Comment options

Answer selected by lucianobosco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants