一樣用這個簡單的繪圖板範例
http://www.blogjava.net/crazycoding/archive/2013/09/13/404016.html
如果我要在網頁裡實做兩塊繪圖板
該怎麼讓他們分別作用呢?
我修改
canvas = document.getElementById('imageView');
context = canvas.getContext('2d');
canvas2 = document.getElementById('imageView2');
context2 = canvas2.getContext('2d');
tool = new tool_pencil();
canvas.addEventListener('mousedown', ev_canvas, false);
canvas.addEventListener('mousemove', ev_canvas, false);
canvas.addEventListener('mouseup', ev_canvas, false);
canvas2.addEventListener('mousedown', ev_canvas, false);
canvas2.addEventListener('mousemove', ev_canvas, false);
canvas2.addEventListener('mouseup', ev_canvas, false);
之後作的操作都依照各自繪圖板的座標 畫到了第一塊板子上XD
能請指點一下問題所在嗎?
感謝!