Skip to content

Commit

Permalink
Corrected a bug where setting fill or stroke to None actually made it…
Browse files Browse the repository at this point in the history
… black rather than turning it off.
  • Loading branch information
neilccbrown committed Dec 9, 2024
1 parent 0484ef3 commit 4bf2bf9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/public_libraries/strype/strype_graphics_internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ var $builtinmodule = function(name) {
});
mod.canvas_setFill = new Sk.builtin.func(function(img, color) {
const ctx = img.getContext("2d");
ctx.fillStyle = Sk.ffi.remapToJs(color);
let colorJs = Sk.ffi.remapToJs(color);
// Note 8 zeroes: this is fully transparent, not black:
ctx.fillStyle = colorJs == null ? "#00000000" : colorJs;
});
mod.canvas_setStroke = new Sk.builtin.func(function(img, color) {
const ctx = img.getContext("2d");
ctx.strokeStyle = Sk.ffi.remapToJs(color);
let colorJs = Sk.ffi.remapToJs(color);
// Note 8 zeroes: this is fully transparent, not black:
ctx.strokeStyle = colorJs == null ? "#00000000" : colorJs;
});
mod.canvas_getPixel = new Sk.builtin.func(function(img, x, y) {
const ctx = img.getContext("2d");
Expand Down

0 comments on commit 4bf2bf9

Please sign in to comment.