diff --git a/src/playground/playground.js b/src/playground/playground.js index 0b288f1..4cc8c42 100644 --- a/src/playground/playground.js +++ b/src/playground/playground.js @@ -37,7 +37,7 @@ image.src = 'https://cdn.assets.scratch.mit.edu/internalapi/asset/7e24c99c1b853e // SVG (cat 1-a) const xhr = new XMLHttpRequest(); -xhr.addEventListener('load', function () { +xhr.addEventListener('load', () => { const skinId = renderer.createSVGSkin(xhr.responseText); if (wantedSkin === WantedSkinType.vector) { renderer.updateDrawableProperties(drawableID2, { @@ -56,10 +56,10 @@ if (wantedSkin === WantedSkinType.pen) { }); canvas.addEventListener('click', event => { - let rect = canvas.getBoundingClientRect(); + const rect = canvas.getBoundingClientRect(); - let x = event.clientX - rect.left; - let y = event.clientY - rect.top; + const x = event.clientX - rect.left; + const y = event.clientY - rect.top; renderer.penLine(penSkinID, { color4f: [Math.random(), Math.random(), Math.random(), 1], @@ -184,7 +184,7 @@ canvas.addEventListener('mousemove', event => { canvas.addEventListener('click', event => { const mousePos = getMousePosition(event, canvas); const pickID = renderer.pick(mousePos.x, mousePos.y); - console.log('You clicked on ' + (pickID < 0 ? 'nothing' : 'ID# ' + pickID)); + console.log(`You clicked on ${(pickID < 0 ? 'nothing' : `ID#${pickID}`)}`); if (pickID >= 0) { console.dir(renderer.extractDrawable(pickID, mousePos.x, mousePos.y)); } diff --git a/src/playground/queryPlayground.js b/src/playground/queryPlayground.js index 7befdf7..0d124bd 100644 --- a/src/playground/queryPlayground.js +++ b/src/playground/queryPlayground.js @@ -92,9 +92,9 @@ renderCanvas.addEventListener('click', event => { } }); -const rgb2fillStyle = (rgb) => { - return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`; -}; +const rgb2fillStyle = rgb => ( + `rgb(${rgb[0]},${rgb[1]},${rgb[2]})` +); const makeCursorImage = () => { const canvas = document.createElement('canvas');