camelCase
This commit is contained in:
parent
2875eda693
commit
4e45032150
@ -17,8 +17,8 @@ public class CanvasService {
|
|||||||
_jsRuntime = jsRuntime;
|
_jsRuntime = jsRuntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string currentcolor { get; set; } = "Black";
|
public string currentColor { get; set; } = "Black";
|
||||||
public int pointsize { get; set; } = 1;
|
public int pointSize { get; set; } = 1;
|
||||||
public bool snap { get; set; }
|
public bool snap { get; set; }
|
||||||
public ElementReference divCanvas { get; set; }
|
public ElementReference divCanvas { get; set; }
|
||||||
public BECanvasComponent myCanvas { get; set; } = new();
|
public BECanvasComponent myCanvas { get; set; } = new();
|
||||||
@ -46,17 +46,17 @@ public class CanvasService {
|
|||||||
_currentCanvasContext = await myCanvas.CreateCanvas2DAsync();
|
_currentCanvasContext = await myCanvas.CreateCanvas2DAsync();
|
||||||
|
|
||||||
if (eventArgs.Buttons == 1) // Couleur si bouton gauche, blanc si bouton droit
|
if (eventArgs.Buttons == 1) // Couleur si bouton gauche, blanc si bouton droit
|
||||||
color = currentcolor;
|
color = currentColor;
|
||||||
|
|
||||||
if (snap) { // Magnétisme boboche.
|
if (snap) { // Magnétisme boboche.
|
||||||
mouseX -= mouseX % pointsize;
|
mouseX -= mouseX % pointSize;
|
||||||
mouseY -= mouseY % pointsize;
|
mouseY -= mouseY % pointSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
command.X = mouseX;
|
command.X = mouseX;
|
||||||
command.Y = mouseY;
|
command.Y = mouseY;
|
||||||
command.Color = color;
|
command.Color = color;
|
||||||
command.PointSize = pointsize;
|
command.PointSize = pointSize;
|
||||||
|
|
||||||
if (command.Equals(_lastCommand))
|
if (command.Equals(_lastCommand))
|
||||||
return; // Pour pas spammer des commandes si c'est pas pertinent.
|
return; // Pour pas spammer des commandes si c'est pas pertinent.
|
||||||
@ -64,7 +64,7 @@ public class CanvasService {
|
|||||||
// TODO: Shipper les commandes à Franz.
|
// TODO: Shipper les commandes à Franz.
|
||||||
|
|
||||||
await _currentCanvasContext.SetFillStyleAsync(color);
|
await _currentCanvasContext.SetFillStyleAsync(color);
|
||||||
await _currentCanvasContext.FillRectAsync(mouseX, mouseY, pointsize, pointsize);
|
await _currentCanvasContext.FillRectAsync(mouseX, mouseY, pointSize, pointSize);
|
||||||
|
|
||||||
_lastCommand = command;
|
_lastCommand = command;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<header style="padding: 5px;">
|
<header style="padding: 5px;">
|
||||||
<h3>Canvas Communautaire!</h3>
|
<h3>Canvas Communautaire!</h3>
|
||||||
<label>Couleur: </label>
|
<label>Couleur: </label>
|
||||||
<select @bind="@canvasService.currentcolor">
|
<select @bind="@canvasService.currentColor">
|
||||||
<option value="Black" selected>Noir</option>
|
<option value="Black" selected>Noir</option>
|
||||||
<option value="Red">Rouge</option>
|
<option value="Red">Rouge</option>
|
||||||
<option value="Blue">Bleu</option>
|
<option value="Blue">Bleu</option>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<option value="White">Blanc</option>
|
<option value="White">Blanc</option>
|
||||||
</select>
|
</select>
|
||||||
<label>Grosseur du trait: </label>
|
<label>Grosseur du trait: </label>
|
||||||
<select @bind="@canvasService.pointsize">
|
<select @bind="@canvasService.pointSize">
|
||||||
<option value="1" selected>1</option>
|
<option value="1" selected>1</option>
|
||||||
<option value="2">2</option>
|
<option value="2">2</option>
|
||||||
<option value="3">3</option>
|
<option value="3">3</option>
|
||||||
@ -43,5 +43,5 @@
|
|||||||
<BECanvas @ref="canvasService.myCanvas" Height="1080" Width="1920"></BECanvas>
|
<BECanvas @ref="canvasService.myCanvas" Height="1080" Width="1920"></BECanvas>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
(c) Cowboy Kim
|
© Cowboy Kim
|
||||||
</footer>
|
</footer>
|
Loading…
Reference in New Issue
Block a user