前几天在
2、主要鼠标事件:
(mouseState === radius = Math.sqrt((oldX - newX) *(oldX - newX)+ (oldY - newY) * (oldY -ctxTemp.arc(newX,newY,10 ,0, Math.PI * 2,= 0ctx.fillStyle = "white"oldX = 0colorDiv = document.getElementById("color"document.getElementById("blackBtn").click(); chosen = parentNode =init = canvas = document.getElementById("canvas"(!canvas || != canvas.getContext("2d"ctx.fillStyle = "white"canvasTemp = document.getElementById("canvasTemp"document.getElementById("undoImage").src="./images/undoDis.png"drawPicture = down, move, chosen, = = event ||ctx.fillStyle = "white"mouseState = image = (type !== "rubber"= shape = document.getElementById("shape"(type !== "rubber"move = newX = event.clientX -(type === "pencil"=(type === "rec"- 10 ,newY - 10(type === "line"(type === "circle"radius = Math.sqrt((oldX - newX) *(oldX - newX)+ (oldY - newY) * (oldY -ctxTemp.arc(newX,newY,10 ,0, Math.PI * 2,(type === "roundRec"+20,oldY, newX+20, oldY+20, 20ctxTemp.moveTo(newX - 10 ,newY - 10(type === "rubber"='#000000'ctx.fillStyle = "white"0,0'mousedown'= 0exportImage = imgSrc = canvas.toDataURL("image/png"undo = (cancelTimes >= imageHistoryList.length+1(cancelTimes =="redoImage").src="./images/redo.png"= imageHistoryList[imageHistoryList.length-1-redo = (cancelTimes < 0(cancelTimes == 0= imageHistoryList[imageHistoryList.length-1-0, 00"load",f,"onload"= true; });