Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant