liewchooichin commited on
Commit
36237b0
·
verified ·
1 Parent(s): c431115

Update draw-web-worker/main.js

Browse files
Files changed (1) hide show
  1. draw-web-worker/main.js +4 -2
draw-web-worker/main.js CHANGED
@@ -44,10 +44,12 @@ if (window.Worker) {
44
  function drawShape(event) {
45
  // initial selection will contain value="", then this to default
46
  // lightgrey square.
 
 
47
  const drawData = {
48
  command: "draw",
49
- selectedColor: color.value.toLowerCase() ? "" : "lightgrey",
50
- selectedShape: shape.value.toLowerCase() ? "" : "square",
51
  }
52
  worker.postMessage(drawData);
53
  worker.addEventListener("message", messageFromWorker);
 
44
  function drawShape(event) {
45
  // initial selection will contain value="", then this to default
46
  // lightgrey square.
47
+ validColor = (color.value!=="" ? color.value : "lightgrey");
48
+ validShape = (shape.value!==""? shape.value : "square");
49
  const drawData = {
50
  command: "draw",
51
+ selectedColor: validColor,
52
+ selectedShape: validShape
53
  }
54
  worker.postMessage(drawData);
55
  worker.addEventListener("message", messageFromWorker);