私は、mudcu の sketch.js のスクリプトを使用して、単純なペイント アプリケーションを作成しました。
コード内でいくつかの変更を加えましたが、鉛筆の色を設定する関数をトリガーするのに問題があります。
var Sketch = function(config) { "use strict";
var that = this;
...........
var ctx2 = layer2d[2];
// Style object.
this.zoom = 1;
this.style = {
tool: "brush",
globalAlpha: 1,
globalCompositeOperation: "source-over",
strokeStyle: "#000",
lineWidth: 5,
lineCap: "round",
lineJoin: "round"
私の質問は、ユーザーがボタンをクリックしたときに、「this.style」の strokeStyle をたとえば「#D55151」に設定するにはどうすればよいですか?