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

Race condition with background image and webStorage enabled #69

Open
Edwardiv1 opened this issue Jun 12, 2020 · 0 comments
Open

Race condition with background image and webStorage enabled #69

Edwardiv1 opened this issue Jun 12, 2020 · 0 comments

Comments

@Edwardiv1
Copy link

Edwardiv1 commented Jun 12, 2020

When a background image (not colour) is specified and webStorage is enabled (either 'local' or 'session'), a race condition clears any drawings on the board, overwriting with the background image.
The condition exists in:

DrawingBoard.Board = function(id, opts) {
...
	//reset the board to take all resized space
	this.reset({ webStorage: false, history: false, background: true });
	// the end of the above function triggers an event, which seems to race with the next restore line
	this.restoreWebStorage(); // this line needs to wait for the earlier trigger to complete.  If stepping through with a dubugger, it works fine because the debugger delays between the steps.
	this.initDropEvents();
	this.initDrawEvents();
};

Code to create the board:

myBoard = new DrawingBoard.Board('bodyconcern', {
  controls: [{DrawingMode: {filler: false, eraser: false}},
		  {Navigation: {back: false, forward: false}}],
  background: "/img.png",
  webStorage: 'session',
  color: '#FF2222',
  eraserColor: '#FFFFFF',
  size: 3,
  enlargeYourContainer: true
});
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

1 participant