mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-14 06:47:55 +01:00
hide travel-lines in canvas and preview
This commit is contained in:
parent
9b6535be11
commit
67976418a3
@ -39,6 +39,8 @@ var lineweight = 2;
|
|||||||
|
|
||||||
var isModified = false;
|
var isModified = false;
|
||||||
|
|
||||||
|
var showTravelLines = false;
|
||||||
|
|
||||||
/* * * * * * * * * *
|
/* * * * * * * * * *
|
||||||
*
|
*
|
||||||
* INIT
|
* INIT
|
||||||
@ -98,8 +100,6 @@ function initDoodleDrawing() {
|
|||||||
*
|
*
|
||||||
* * * * * * * * * */
|
* * * * * * * * * */
|
||||||
function draw(_x, _y, _width) {
|
function draw(_x, _y, _width) {
|
||||||
//console.log("canvasDrawing:draw");
|
|
||||||
// console.log("f:draw() >> _width: " + _width);
|
|
||||||
|
|
||||||
if (prevX == 0 && prevY ==0) {
|
if (prevX == 0 && prevY ==0) {
|
||||||
prevX = _x;
|
prevX = _x;
|
||||||
@ -108,7 +108,12 @@ function draw(_x, _y, _width) {
|
|||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(prevX, prevY);
|
ctx.moveTo(prevX, prevY);
|
||||||
ctx.lineTo(_x, _y);
|
|
||||||
|
if (showTravelLines || _width==undefined) { //when _width=0.5 it's a travel line, when it's not supplied it's a real line.
|
||||||
|
ctx.lineTo(_x, _y);
|
||||||
|
} else {
|
||||||
|
ctx.moveTo(_x, _y);
|
||||||
|
}
|
||||||
|
|
||||||
if (_width != undefined) {
|
if (_width != undefined) {
|
||||||
ctx.lineWidth = _width;
|
ctx.lineWidth = _width;
|
||||||
@ -202,7 +207,7 @@ function redrawDoodle(recalcBoundsAndTransforms) {
|
|||||||
for (var i = 0; i < _points.length; i++) {
|
for (var i = 0; i < _points.length; i++) {
|
||||||
// console.log(" drawing points " + _points[i]);
|
// console.log(" drawing points " + _points[i]);
|
||||||
if (_points[i][2] == true) {
|
if (_points[i][2] == true) {
|
||||||
draw(_points[i][0], _points[i][1], 0.5);
|
draw(_points[i][0], _points[i][1], 0.5); //draw moves as thin lines
|
||||||
} else {
|
} else {
|
||||||
draw(_points[i][0], _points[i][1]);
|
draw(_points[i][0], _points[i][1]);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@ var previewCtx_tmp;
|
|||||||
|
|
||||||
var previewDefaults = {
|
var previewDefaults = {
|
||||||
rotation: 0, //Math.PI/90,
|
rotation: 0, //Math.PI/90,
|
||||||
numLayers: 10
|
numLayers: 5, //was 10
|
||||||
|
showTravelLines: false
|
||||||
}
|
}
|
||||||
|
|
||||||
var svgPathRegExp = /[LM]\d* \d*/ig;
|
var svgPathRegExp = /[LM]\d* \d*/ig;
|
||||||
@ -189,7 +190,12 @@ function renderToImageDataPreview() {
|
|||||||
previewCtx_tmp.moveTo(adjustedDoodlePt.x, adjustedDoodlePt.y);
|
previewCtx_tmp.moveTo(adjustedDoodlePt.x, adjustedDoodlePt.y);
|
||||||
for(var j = 1; j < _points.length; j++) {
|
for(var j = 1; j < _points.length; j++) {
|
||||||
adjustedDoodlePt = centeredAndScaledDoodlePoint(_points[j])
|
adjustedDoodlePt = centeredAndScaledDoodlePoint(_points[j])
|
||||||
previewCtx_tmp.lineTo(adjustedDoodlePt.x, adjustedDoodlePt.y);
|
|
||||||
|
if (!previewDefaults.showTravelLines && _points[j][2]==true) {
|
||||||
|
previewCtx_tmp.moveTo(adjustedDoodlePt.x, adjustedDoodlePt.y);
|
||||||
|
} else {
|
||||||
|
previewCtx_tmp.lineTo(adjustedDoodlePt.x, adjustedDoodlePt.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
previewCtx_tmp.stroke();
|
previewCtx_tmp.stroke();
|
||||||
previewCtx_tmp.closePath();
|
previewCtx_tmp.closePath();
|
||||||
@ -303,6 +309,7 @@ function centeredAndScaledDoodlePoint(p) {
|
|||||||
var updatePrevX = -1;
|
var updatePrevX = -1;
|
||||||
var updatePrevY = -1;
|
var updatePrevY = -1;
|
||||||
function updatePreview(_x, _y, redrawLess) {
|
function updatePreview(_x, _y, redrawLess) {
|
||||||
|
|
||||||
//console.log("PreviewRendering:updatePreview");
|
//console.log("PreviewRendering:updatePreview");
|
||||||
if (redrawLess == undefined) redrawLess = false;
|
if (redrawLess == undefined) redrawLess = false;
|
||||||
redrawLess = false;
|
redrawLess = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user