0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-09-21 19:30:07 +02:00
doodle3d-client/www/js/patch.patch

7 lines
32 KiB
Diff
Raw Normal View History

3c3
< break;case verticalShapes.SINUS:b=.25*Math.cos(a*Math.PI*4)+.75}return b}function doOnResize(){canvas.width=$canvas.width(),canvas.height=$canvas.height(),preview.width=$preview.width(),preview.height=$drawAreaContainer.height(),canvasWidth=canvas.width,canvasHeight=canvas.height,calcPreviewCanvasProperties(),drawCanvasTopLeftCoords[0]=drawCanvas.offset().left,drawCanvasTopLeftCoords[1]=drawCanvas.offset().top,redrawDoodle(),redrawPreview()}function initLayouting(){$drawAreaContainer=$("#drawareacontainer"),canvas.width=$canvas.width(),canvas.height=$canvas.height(),preview.width=$preview.width(),preview.height=$drawAreaContainer.height(),canvasWidth=canvas.width,canvasHeight=canvas.height,$drawAreaContainer.show(),setTimeout(_startOrientationAndChangeEventListening,1e3)}function _startOrientationAndChangeEventListening(){$(window).on("resize",doOnResize),doOnResize()}function initPreviewRendering(){$preview=$("#preview"),preview=$preview[0],previewCtx=preview.getContext("2d");var a=preview.width/canvas.width;preview_tmp=document.getElementById("preview_tmp"),preview_tmp.width=preview.width,preview_tmp.height=canvas.height*a,$("#preview_tmp").css("top",-preview_tmp.height),previewCtx_tmp=preview_tmp.getContext("2d"),calcPreviewCanvasProperties(),redrawPreview()}function calcPreviewCanvasProperties(){globalScale=preview.width/canvasWidth,layerCX=canvasWidth/2*globalScale,layerCY=canvasHeight/2*globalScale,layerOffsetY=preview.height*(1-previewVerticalPadding.bottom),yStep=(preview.height-preview.height*(previewVerticalPadding.top+previewVerticalPadding.bottom))/maxNumLayers}function redrawPreview(a){if(void 0==a&&(a=!1),_points.length<2)return void previewCtx.clearRect(0,0,preview.width,preview.height);a||(debug_redrawSimplification=_points.length<100?6:_points.length<250?7:_points.length<400?8:_points.length<550?9:_points.length<700?10:11);var b=0,c=0;previewCtx.clearRect(0,0,preview.width,preview.height),previewCtx.lineWidth=strokeWidth,previewCtx.strokeStyle="#f00";for(var d=0;numLayers>d;d++){var e=scaleFunction(d/maxNumLayers);if(previewCtx.globalAlpha=0==d||d==Math.floor(numLayers/2)||d==numLayers-1?1:globalAlpha,a&&d%debug_redrawSimplification!=0&&0!=d&&d!=Math.floor(numLayers/2)&&d!=numLayers-1)b-=yStep,c+=rStep;else{previewCtx.save(),previewCtx.translate(layerCX,layerOffsetY+b),previewCtx.scale(viewerScale*e,scaleY*viewerScale*e),previewCtx.rotate(c),previewCtx.translate(-doodleTransform[0]*globalScale*doodleTransform[2],-doodleTransform[1]*globalScale*doodleTransform[3]);var f=centeredAndScaledDoodlePoint(_points[0]);previewCtx.beginPath(),previewCtx.moveTo(f.x,f.y);for(var g=1;g<_points.length;g++)f=centeredAndScaledDoodlePoint(_points[g]),a&&g%debug_redrawSimplification!=0||previewCtx.lineTo(f.x,f.y);previewCtx.stroke(),b-=yStep,c+=rStep,previewCtx.restore()}}previewCtx.globalAlpha=globalAlpha}function renderToImageDataPreview(){if(!(_points.length<2)){previewCtx_tmp.clearRect(0,0,preview.width,preview.height),previewCtx_tmp.lineWidth=strokeWidth,previewCtx_tmp.strokeStyle="#f00",previewCtx_tmp.save(),previewCtx_tmp.translate(layerCX,layerCY),previewCtx_tmp.scale(viewerScale,viewerScale),previewCtx_tmp.translate(-doodleTransform[0]*globalScale*doodleTransform[2],-doodleTransform[1]*globalScale*doodleTransform[3]);var a=centeredAndScaledDoodlePoint(_points[0]);previewCtx_tmp.beginPath(),previewCtx_tmp.moveTo(a.x,a.y);for(var b=1;b<_points.length;b++)a=centeredAndScaledDoodlePoint(_points[b]),previewDefaults.showTravelLines||1!=_points[b][2]?previewCtx_tmp.lineTo(a.x,a.y):previewCtx_tmp.moveTo(a.x,a.y);previewCtx_tmp.stroke(),previewCtx_tmp.closePath(),previewCtx_tmp.restore();var c=preview_tmp.toDataURL();doodleImageCapture=new Image,doodleImageCapture.onload=function(){previewCtx.clearRect(0,0,preview.width,preview.height),previewCtx.lineWidth=strokeWidth,previewCtx.strokeStyle="#f00";for(var a=0,b=0,c=0;numLayers>c;c++){var d=scaleFunction(c/maxNumLayers);previewCtx.globalAlpha=0==c||c==Math.floor(numLayers/2)||c==numLayers-1?1:globalAlpha,previewCtx.save(),previewCtx.translate(layerCX,layerOffsetY+a),prev
\ No newline at end of file
---
> break;case verticalShapes.SINUS:b=.25*Math.cos(a*Math.PI*4)+.75}return b}function doOnResize(){canvas.width=$canvas.width(),canvas.height=$canvas.height(),preview.width=$preview.width(),preview.height=$drawAreaContainer.height(),canvasWidth=canvas.width,canvasHeight=canvas.height,calcPreviewCanvasProperties(),drawCanvasTopLeftCoords[0]=drawCanvas.offset().left,drawCanvasTopLeftCoords[1]=drawCanvas.offset().top,redrawDoodle(),redrawPreview()}function initLayouting(){$drawAreaContainer=$("#drawareacontainer"),canvas.width=$canvas.width(),canvas.height=$canvas.height(),preview.width=$preview.width(),preview.height=$drawAreaContainer.height(),canvasWidth=canvas.width,canvasHeight=canvas.height,$drawAreaContainer.show(),setTimeout(_startOrientationAndChangeEventListening,1e3)}function _startOrientationAndChangeEventListening(){$(window).on("resize",doOnResize),doOnResize()}function initPreviewRendering(){$preview=$("#preview"),preview=$preview[0],previewCtx=preview.getContext("2d");var a=preview.width/canvas.width;preview_tmp=document.getElementById("preview_tmp"),preview_tmp.width=preview.width,preview_tmp.height=canvas.height*a,$("#preview_tmp").css("top",-preview_tmp.height),previewCtx_tmp=preview_tmp.getContext("2d"),calcPreviewCanvasProperties(),redrawPreview()}function calcPreviewCanvasProperties(){globalScale=preview.width/canvasWidth,layerCX=canvasWidth/2*globalScale,layerCY=canvasHeight/2*globalScale,layerOffsetY=preview.height*(1-previewVerticalPadding.bottom),yStep=(preview.height-preview.height*(previewVerticalPadding.top+previewVerticalPadding.bottom))/maxNumLayers}function redrawPreview(a){if(void 0==a&&(a=!1),_points.length<2)return void previewCtx.clearRect(0,0,preview.width,preview.height);a||(debug_redrawSimplification=_points.length<100?6:_points.length<250?7:_points.length<400?8:_points.length<550?9:_points.length<700?10:11);var b=0,c=0;previewCtx.clearRect(0,0,preview.width,preview.height),previewCtx.lineWidth=strokeWidth,previewCtx.strokeStyle="#f00";for(var d=0;numLayers>d;d++){var e=scaleFunction(d/maxNumLayers);if(previewCtx.globalAlpha=0==d||d==Math.floor(numLayers/2)||d==numLayers-1?1:globalAlpha,a&&d%debug_redrawSimplification!=0&&0!=d&&d!=Math.floor(numLayers/2)&&d!=numLayers-1)b-=yStep,c+=rStep;else{previewCtx.save(),previewCtx.translate(layerCX,layerOffsetY+b),previewCtx.scale(viewerScale*e,scaleY*viewerScale*e),previewCtx.rotate(c),previewCtx.translate(-doodleTransform[0]*globalScale*doodleTransform[2],-doodleTransform[1]*globalScale*doodleTransform[3]);var f=centeredAndScaledDoodlePoint(_points[0]);previewCtx.beginPath(),previewCtx.moveTo(f.x,f.y);for(var g=1;g<_points.length;g++)f=centeredAndScaledDoodlePoint(_points[g]),a&&g%debug_redrawSimplification!=0||previewCtx.lineTo(f.x,f.y);previewCtx.stroke(),b-=yStep,c+=rStep,previewCtx.restore()}}previewCtx.globalAlpha=globalAlpha}function renderToImageDataPreview(){if(!(_points.length<2)){previewCtx_tmp.clearRect(0,0,preview.width,preview.height),previewCtx_tmp.lineWidth=strokeWidth,previewCtx_tmp.strokeStyle="#f00",previewCtx_tmp.save(),previewCtx_tmp.translate(layerCX,layerCY),previewCtx_tmp.scale(viewerScale,viewerScale),previewCtx_tmp.translate(-doodleTransform[0]*globalScale*doodleTransform[2],-doodleTransform[1]*globalScale*doodleTransform[3]);var a=centeredAndScaledDoodlePoint(_points[0]);previewCtx_tmp.beginPath(),previewCtx_tmp.moveTo(a.x,a.y);for(var b=1;b<_points.length;b++)a=centeredAndScaledDoodlePoint(_points[b]),previewDefaults.showTravelLines||1!=_points[b][2]?previewCtx_tmp.lineTo(a.x,a.y):previewCtx_tmp.moveTo(a.x,a.y);previewCtx_tmp.stroke(),previewCtx_tmp.closePath(),previewCtx_tmp.restore();var c=preview_tmp.toDataURL();doodleImageCapture=new Image,doodleImageCapture.onload=function(){previewCtx.clearRect(0,0,preview.width,preview.height),previewCtx.lineWidth=strokeWidth,previewCtx.strokeStyle="#f00";for(var a=0,b=0,c=0;numLayers>c;c++){var d=scaleFunction(c/maxNumLayers);previewCtx.globalAlpha=0==c||c==Math.floor(numLayers/2)||c==numLayers-1?1:globalAlpha,previewCtx.save(),previewCtx.translate(layerCX,layerOffsetY+a),prev
\ No newline at end of file