Skip to content

Commit

Permalink
Fix appearance of point sources in color mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Jan 25, 2023
1 parent 1302a85 commit ef4f2fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion simulator/js/objs/led.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ objTypes['led'] = {

//將物件畫到Canvas上 Draw the obj on canvas
draw: function(obj, canvas) {
ctx.fillStyle = getMouseStyle(obj, colorMode? wavelengthToColor(obj.wavelength || GREEN_WAVELENGTH, 1) : 'rgb(0,255,0)');
ctx.fillStyle = colorMode? wavelengthToColor(obj.wavelength || GREEN_WAVELENGTH, 1) : getMouseStyle(obj, 'rgb(0,255,0)');
ctx.fillRect(obj.p1.x - 2.5, obj.p1.y - 2.5, 5, 5);
if (colorMode) {
ctx.fillStyle = getMouseStyle(obj, 'rgb(255,255,255)');
ctx.fillRect(obj.p1.x - 1.5, obj.p1.y - 1.5, 3, 3);
}
ctx.fillStyle = getMouseStyle(obj, 'rgb(255,0,0)');
ctx.fillRect(obj.p2.x - 1.5, obj.p2.y - 1.5, 3, 3);
},
Expand Down
6 changes: 5 additions & 1 deletion simulator/js/objs/radiant.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ objTypes['radiant'] = {

//將物件畫到Canvas上 Draw the obj on canvas
draw: function(obj, canvas) {
ctx.fillStyle = getMouseStyle(obj, colorMode? 'rgb(255,255,255)' : 'rgb(0,255,0)');
ctx.fillStyle = colorMode? wavelengthToColor(obj.wavelength || GREEN_WAVELENGTH, 1) : getMouseStyle(obj, 'rgb(0,255,0)');
ctx.fillRect(obj.x - 2.5, obj.y - 2.5, 5, 5);
if (colorMode) {
ctx.fillStyle = getMouseStyle(obj, 'rgb(255,255,255)');
ctx.fillRect(obj.x - 1.5, obj.y - 1.5, 3, 3);
}
},

//平移物件 Move the object
Expand Down

0 comments on commit ef4f2fc

Please sign in to comment.