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

Race condition with background image and webStorage enabled #69

@Edwardiv1

Description

@Edwardiv1

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
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions