Skip to content

Commit

Permalink
Change setting of color via context.fillStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
RudolfVonKrugstein committed Jul 25, 2012
1 parent f4c2202 commit 2f4dd24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 3_FirstInteractive/code/haste/helpers.js
Expand Up @@ -28,7 +28,7 @@ function jsFillRect(context, x, y, width, height, _) {
}

function jsSetFillColor(context, color, _) {
context.setFillColor(color);
context.fillStyle = color;
return [1,0];
}

Expand Down
2 changes: 1 addition & 1 deletion 3_FirstInteractive/code/uhc/JavaScript.hs
Expand Up @@ -26,7 +26,7 @@ getContext2d canvasName = do

foreign import js "%1.fillRect(%*)"
fillRect :: Context2D -> Double -> Double -> Double -> Double -> IO ()
foreign import js "%1.setFillColor(%*)"
foreign import js "jsSetFillColor(%*)"
jsSetFillColor :: Context2D -> JSString -> IO ()
setFillColor ctx = jsSetFillColor ctx . toJS
foreign import js "%1.clearRect(%2, %3, %4, %5)"
Expand Down
4 changes: 4 additions & 0 deletions 3_FirstInteractive/code/uhc/helpers.js
Expand Up @@ -7,3 +7,7 @@ function jsSaveGlobalObject(name, obj) {
function jsLoadGlobalObject(name) {
return allObjects[name];
}

function jsSetFillColor(context, color) {
context.fillStyle = color;
}

0 comments on commit 2f4dd24

Please sign in to comment.