Commit 3bdb0d23 by Masaru Abe

リファクタリング修正

parent 5496b3a5
...@@ -169,9 +169,9 @@ CONTENTVIEW.displayCanvasDraw = function() { ...@@ -169,9 +169,9 @@ CONTENTVIEW.displayCanvasDraw = function() {
CONTENTVIEW_GENERAL.isDrawing = false; CONTENTVIEW_GENERAL.isDrawing = false;
/* clear canvas */ /* clear canvas */
context_draw.clearRect(0, 0, CONTENTVIEW_GENERAL.canvas_draw.width, CONTENTVIEW_GENERAL.canvas_draw.height); CONTENTVIEW_GENERAL.context_draw.clearRect(0, 0, CONTENTVIEW_GENERAL.canvas_draw.width, CONTENTVIEW_GENERAL.canvas_draw.height);
context_draw.save(); CONTENTVIEW_GENERAL.context_draw.save();
/* set draw image if exist */ /* set draw image if exist */
var dataMarking = ClientData.MarkingData(); var dataMarking = ClientData.MarkingData();
...@@ -182,7 +182,7 @@ CONTENTVIEW.displayCanvasDraw = function() { ...@@ -182,7 +182,7 @@ CONTENTVIEW.displayCanvasDraw = function() {
var img = new Image(); var img = new Image();
img.onload = function () { img.onload = function () {
context_draw.drawImage(img, 0, 0, CONTENTVIEW_GENERAL.canvas_draw.width, CONTENTVIEW_GENERAL.canvas_draw.height); CONTENTVIEW_GENERAL.context_draw.drawImage(img, 0, 0, CONTENTVIEW_GENERAL.canvas_draw.width, CONTENTVIEW_GENERAL.canvas_draw.height);
/*set flag has image */ /*set flag has image */
CONTENTVIEW_GENERAL.isDrawing = true; CONTENTVIEW_GENERAL.isDrawing = true;
...@@ -191,7 +191,7 @@ CONTENTVIEW.displayCanvasDraw = function() { ...@@ -191,7 +191,7 @@ CONTENTVIEW.displayCanvasDraw = function() {
} }
} }
context_draw.restore(); CONTENTVIEW_GENERAL.context_draw.restore();
/* visible canvas using for draw */ /* visible canvas using for draw */
$('#draw_canvas').css('display', 'block'); $('#draw_canvas').css('display', 'block');
...@@ -1500,8 +1500,8 @@ CONTENTVIEW.tool_drawing = function() { ...@@ -1500,8 +1500,8 @@ CONTENTVIEW.tool_drawing = function() {
CONTENTVIEW_GENERAL.sy = ev._y; CONTENTVIEW_GENERAL.sy = ev._y;
if ($("#marker_canvas").is(":hidden")) { if ($("#marker_canvas").is(":hidden")) {
context_draw.beginPath(); CONTENTVIEW_GENERAL.context_draw.beginPath();
context_draw.moveTo(ev._x, ev._y); CONTENTVIEW_GENERAL.context_draw.moveTo(ev._x, ev._y);
} else { } else {
CONTENTVIEW_GENERAL.context_marker.beginPath(); CONTENTVIEW_GENERAL.context_marker.beginPath();
CONTENTVIEW_GENERAL.context_marker.moveTo(ev._x, ev._y); CONTENTVIEW_GENERAL.context_marker.moveTo(ev._x, ev._y);
...@@ -1513,45 +1513,45 @@ CONTENTVIEW.tool_drawing = function() { ...@@ -1513,45 +1513,45 @@ CONTENTVIEW.tool_drawing = function() {
if ($("#marker_canvas").is(":hidden")) { if ($("#marker_canvas").is(":hidden")) {
if (CONTENTVIEW_GENERAL.markingType == 'eraser') { if (CONTENTVIEW_GENERAL.markingType == 'eraser') {
context_draw.globalCompositeOperation = 'destination-out'; CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'destination-out';
context_draw.lineWidth = CONTENTVIEW_GENERAL.eraseSize; CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.eraseSize;
context_draw.lineJoin = 'round'; CONTENTVIEW_GENERAL.context_draw.lineJoin = 'round';
context_draw.lineCap = 'round'; CONTENTVIEW_GENERAL.context_draw.lineCap = 'round';
context_draw.lineTo(ev._x + 0.001, ev._y + 0.001); CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
context_draw.stroke(); CONTENTVIEW_GENERAL.context_draw.stroke();
context_draw.globalCompositeOperation = 'source-over'; CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'source-over';
} }
else if (CONTENTVIEW_GENERAL.markingType == 'pen') { else if (CONTENTVIEW_GENERAL.markingType == 'pen') {
/* set flag */ /* set flag */
CONTENTVIEW_GENERAL.isDrawing = true; CONTENTVIEW_GENERAL.isDrawing = true;
context_draw.lineCap = "round"; CONTENTVIEW_GENERAL.context_draw.lineCap = "round";
context_draw.lineWidth = CONTENTVIEW_GENERAL.penSize; CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.penSize;
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.penColor; CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.penColor;
context_draw.lineTo(ev._x + 0.001, ev._y + 0.001); CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
context_draw.stroke(); CONTENTVIEW_GENERAL.context_draw.stroke();
} }
else if (CONTENTVIEW_GENERAL.markingType == 'maker') { else if (CONTENTVIEW_GENERAL.markingType == 'maker') {
/* set flag */ /* set flag */
CONTENTVIEW_GENERAL.isDrawing = true; CONTENTVIEW_GENERAL.isDrawing = true;
context_draw.globalCompositeOperation = 'destination-out'; CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'destination-out';
context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize; CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize; CONTENTVIEW_GENERAL.context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineTo(ev._x, ev._y + 0.001); CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x, ev._y + 0.001);
context_draw.lineCap = 'square'; CONTENTVIEW_GENERAL.context_draw.lineCap = 'square';
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor; CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
context_draw.stroke(); CONTENTVIEW_GENERAL.context_draw.stroke();
context_draw.globalCompositeOperation = 'lighter'; CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'lighter';
context_draw.lineCap = "square"; CONTENTVIEW_GENERAL.context_draw.lineCap = "square";
context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize; CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize; CONTENTVIEW_GENERAL.context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
context_draw.globalAlpha = 0.4; CONTENTVIEW_GENERAL.context_draw.globalAlpha = 0.4;
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor; CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
context_draw.lineTo(ev._x, ev._y + 0.001); CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x, ev._y + 0.001);
context_draw.stroke(); CONTENTVIEW_GENERAL.context_draw.stroke();
context_draw.globalAlpha = 1; CONTENTVIEW_GENERAL.context_draw.globalAlpha = 1;
} }
} else { } else {
if (CONTENTVIEW_GENERAL.markingType == 'eraser') { if (CONTENTVIEW_GENERAL.markingType == 'eraser') {
...@@ -1601,14 +1601,14 @@ CONTENTVIEW.tool_drawing = function() { ...@@ -1601,14 +1601,14 @@ CONTENTVIEW.tool_drawing = function() {
if (ev.which == 1) { CONTENTVIEW_GENERAL.isPressLeftMouse = true; } if (ev.which == 1) { CONTENTVIEW_GENERAL.isPressLeftMouse = true; }
} }
//context_draw.closePath(); //CONTENTVIEW_GENERAL.context_draw.closePath();
}; };
this.mousemove = function (ev) { this.mousemove = function (ev) {
ev.preventDefault(); ev.preventDefault();
if (CONTENTVIEW_GENERAL.isAddingMarking == true) { if (CONTENTVIEW_GENERAL.isAddingMarking == true) {
if ($("#marker_canvas").is(":hidden")) { if ($("#marker_canvas").is(":hidden")) {
CONTENTVIEW.drawMouseMove(context_draw, ev); CONTENTVIEW.drawMouseMove(CONTENTVIEW_GENERAL.context_draw, ev);
} else { } else {
CONTENTVIEW.drawMouseMove(CONTENTVIEW_GENERAL.context_marker, ev); CONTENTVIEW.drawMouseMove(CONTENTVIEW_GENERAL.context_marker, ev);
} }
...@@ -1621,7 +1621,7 @@ CONTENTVIEW.tool_drawing = function() { ...@@ -1621,7 +1621,7 @@ CONTENTVIEW.tool_drawing = function() {
if (tool.started) { if (tool.started) {
//tool.mousemove(ev); //tool.mousemove(ev);
tool.started = false; tool.started = false;
//context_draw.closePath(); //CONTENTVIEW_GENERAL.context_draw.closePath();
//CONTENTVIEW_GENERAL.isPressLeftMouse = false; //CONTENTVIEW_GENERAL.isPressLeftMouse = false;
} }
}; };
...@@ -1631,7 +1631,7 @@ CONTENTVIEW.tool_drawing = function() { ...@@ -1631,7 +1631,7 @@ CONTENTVIEW.tool_drawing = function() {
if (tool.started) { if (tool.started) {
//tool.mousemove(ev); //tool.mousemove(ev);
//tool.started = false; //tool.started = false;
//context_draw.closePath(); //CONTENTVIEW_GENERAL.context_draw.closePath();
CONTENTVIEW_GENERAL.isMoveOutDrawCanvas = true; CONTENTVIEW_GENERAL.isMoveOutDrawCanvas = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment