diff --git a/README.md b/README.md index d7ee2a7c..50386eed 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Then you can run ``` $ npm run local-install $ ln -s node_modules/pyret-lang pyret +$ git submodule init +$ git submodule update $ npm run build ``` diff --git a/src/web/js/output-ui.js b/src/web/js/output-ui.js index 392841fb..6b6e26d8 100644 --- a/src/web/js/output-ui.js +++ b/src/web/js/output-ui.js @@ -41,6 +41,14 @@ return converter([74, a, b]); } + // Snap wants colors specified as "r,g,b(,a)" where each is [0-255] + var snapConverter = $.colorspaces.converter('CIELAB', 'sRGB') + function hueToSnapColor(hue) { + var a = 40*Math.cos(hue); + var b = 40*Math.sin(hue) + return snapConverter([74, a, b]).map(x => Math.floor(x * 255)).join(",") + } + var goldenAngle = 2.39996322972865332; var lastHue = 0; @@ -1075,8 +1083,20 @@ window.requestAnimationFrame(function() { logger.log("highlight_anchor_hover", { error_id: context, anchor_id: id }); - if (positions[0] !== undefined) - positions[0].hint(); + + if (positions[0] !== undefined) { + if(CPO.blocksIDE) { + // Blocks editor case + var snapColor = hueToSnapColor(color); + CPO.blocksIDE.flashSpriteScriptAt( + locsArray[0].dict['start-char'] + 1, + undefined, + snapColor); + } else { + // Non-Blocks editor + positions[0].hint(); + } + } emphasize(color); }); }); @@ -1084,7 +1104,14 @@ logger.log("highlight_anchor_mouseleave", { error_id: context, anchor_id: id }); window.requestAnimationFrame(function() { - unhintLoc(); + // Blocks editor case + if(CPO.blocksIDE) { + if(positions.length > 0) { + CPO.blocksIDE.unflashSpriteScripts(); + } + } else { + unhintLoc(); + } demphasize(color); }); }); diff --git a/src/web/js/snap b/src/web/js/snap index 5937085e..67dc2dc2 160000 --- a/src/web/js/snap +++ b/src/web/js/snap @@ -1 +1 @@ -Subproject commit 5937085ed8c0837f82d7372d1eb938ae7fc07362 +Subproject commit 67dc2dc2ba1abe0afb4c055848b6d70e50c7ae2b