Commit 3bdb0d23 by Masaru Abe

リファクタリング修正

parent 5496b3a5
......@@ -169,9 +169,9 @@ CONTENTVIEW.displayCanvasDraw = function() {
CONTENTVIEW_GENERAL.isDrawing = false;
/* 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 */
var dataMarking = ClientData.MarkingData();
......@@ -182,7 +182,7 @@ CONTENTVIEW.displayCanvasDraw = function() {
var img = new Image();
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 */
CONTENTVIEW_GENERAL.isDrawing = true;
......@@ -191,7 +191,7 @@ CONTENTVIEW.displayCanvasDraw = function() {
}
}
context_draw.restore();
CONTENTVIEW_GENERAL.context_draw.restore();
/* visible canvas using for draw */
$('#draw_canvas').css('display', 'block');
......@@ -1500,8 +1500,8 @@ CONTENTVIEW.tool_drawing = function() {
CONTENTVIEW_GENERAL.sy = ev._y;
if ($("#marker_canvas").is(":hidden")) {
context_draw.beginPath();
context_draw.moveTo(ev._x, ev._y);
CONTENTVIEW_GENERAL.context_draw.beginPath();
CONTENTVIEW_GENERAL.context_draw.moveTo(ev._x, ev._y);
} else {
CONTENTVIEW_GENERAL.context_marker.beginPath();
CONTENTVIEW_GENERAL.context_marker.moveTo(ev._x, ev._y);
......@@ -1513,45 +1513,45 @@ CONTENTVIEW.tool_drawing = function() {
if ($("#marker_canvas").is(":hidden")) {
if (CONTENTVIEW_GENERAL.markingType == 'eraser') {
context_draw.globalCompositeOperation = 'destination-out';
context_draw.lineWidth = CONTENTVIEW_GENERAL.eraseSize;
context_draw.lineJoin = 'round';
context_draw.lineCap = 'round';
context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
context_draw.stroke();
context_draw.globalCompositeOperation = 'source-over';
CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'destination-out';
CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.eraseSize;
CONTENTVIEW_GENERAL.context_draw.lineJoin = 'round';
CONTENTVIEW_GENERAL.context_draw.lineCap = 'round';
CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
CONTENTVIEW_GENERAL.context_draw.stroke();
CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'source-over';
}
else if (CONTENTVIEW_GENERAL.markingType == 'pen') {
/* set flag */
CONTENTVIEW_GENERAL.isDrawing = true;
context_draw.lineCap = "round";
context_draw.lineWidth = CONTENTVIEW_GENERAL.penSize;
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.penColor;
context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
context_draw.stroke();
CONTENTVIEW_GENERAL.context_draw.lineCap = "round";
CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.penSize;
CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.penColor;
CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x + 0.001, ev._y + 0.001);
CONTENTVIEW_GENERAL.context_draw.stroke();
}
else if (CONTENTVIEW_GENERAL.markingType == 'maker') {
/* set flag */
CONTENTVIEW_GENERAL.isDrawing = true;
context_draw.globalCompositeOperation = 'destination-out';
context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineTo(ev._x, ev._y + 0.001);
context_draw.lineCap = 'square';
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
context_draw.stroke();
context_draw.globalCompositeOperation = 'lighter';
context_draw.lineCap = "square";
context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
context_draw.globalAlpha = 0.4;
context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
context_draw.lineTo(ev._x, ev._y + 0.001);
context_draw.stroke();
context_draw.globalAlpha = 1;
CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'destination-out';
CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
CONTENTVIEW_GENERAL.context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x, ev._y + 0.001);
CONTENTVIEW_GENERAL.context_draw.lineCap = 'square';
CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
CONTENTVIEW_GENERAL.context_draw.stroke();
CONTENTVIEW_GENERAL.context_draw.globalCompositeOperation = 'lighter';
CONTENTVIEW_GENERAL.context_draw.lineCap = "square";
CONTENTVIEW_GENERAL.context_draw.lineWidth = CONTENTVIEW_GENERAL.makerSize;
CONTENTVIEW_GENERAL.context_draw.lineHeight = CONTENTVIEW_GENERAL.makerSize;
CONTENTVIEW_GENERAL.context_draw.globalAlpha = 0.4;
CONTENTVIEW_GENERAL.context_draw.strokeStyle = "#" + CONTENTVIEW_GENERAL.makerColor;
CONTENTVIEW_GENERAL.context_draw.lineTo(ev._x, ev._y + 0.001);
CONTENTVIEW_GENERAL.context_draw.stroke();
CONTENTVIEW_GENERAL.context_draw.globalAlpha = 1;
}
} else {
if (CONTENTVIEW_GENERAL.markingType == 'eraser') {
......@@ -1601,14 +1601,14 @@ CONTENTVIEW.tool_drawing = function() {
if (ev.which == 1) { CONTENTVIEW_GENERAL.isPressLeftMouse = true; }
}
//context_draw.closePath();
//CONTENTVIEW_GENERAL.context_draw.closePath();
};
this.mousemove = function (ev) {
ev.preventDefault();
if (CONTENTVIEW_GENERAL.isAddingMarking == true) {
if ($("#marker_canvas").is(":hidden")) {
CONTENTVIEW.drawMouseMove(context_draw, ev);
CONTENTVIEW.drawMouseMove(CONTENTVIEW_GENERAL.context_draw, ev);
} else {
CONTENTVIEW.drawMouseMove(CONTENTVIEW_GENERAL.context_marker, ev);
}
......@@ -1621,7 +1621,7 @@ CONTENTVIEW.tool_drawing = function() {
if (tool.started) {
//tool.mousemove(ev);
tool.started = false;
//context_draw.closePath();
//CONTENTVIEW_GENERAL.context_draw.closePath();
//CONTENTVIEW_GENERAL.isPressLeftMouse = false;
}
};
......@@ -1631,7 +1631,7 @@ CONTENTVIEW.tool_drawing = function() {
if (tool.started) {
//tool.mousemove(ev);
//tool.started = false;
//context_draw.closePath();
//CONTENTVIEW_GENERAL.context_draw.closePath();
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