11/* PCB rendering code */
22
3+ var redrawOnDrag = true ;
4+
35function deg2rad ( deg ) {
46 return deg * Math . PI / 180 ;
57}
@@ -52,7 +54,7 @@ function drawtext(ctx, scalefactor, text, color, flip) {
5254
5355function drawedge ( ctx , scalefactor , edge , color ) {
5456 ctx . strokeStyle = color ;
55- ctx . lineWidth = Math . max ( 2 , edge . width ) / scalefactor ;
57+ ctx . lineWidth = Math . max ( 1 / scalefactor , edge . width ) ;
5658 ctx . lineCap = "round" ;
5759 if ( edge . type == "segment" ) {
5860 ctx . beginPath ( ) ;
@@ -349,8 +351,8 @@ function handleMouseUp(e, layerdict) {
349351 layerdict . transform . panx = 0 ;
350352 layerdict . transform . pany = 0 ;
351353 layerdict . transform . zoom = 1 ;
352- redrawCanvas ( layerdict ) ;
353354 }
355+ redrawCanvas ( layerdict ) ;
354356}
355357
356358function handleMouseMove ( e , layerdict ) {
@@ -365,7 +367,9 @@ function handleMouseMove(e, layerdict) {
365367 layerdict . transform . pany += 2 * dy / layerdict . transform . zoom ;
366368 layerdict . transform . mousestartx = e . offsetX ;
367369 layerdict . transform . mousestarty = e . offsetY ;
368- redrawCanvas ( layerdict ) ;
370+ if ( redrawOnDrag ) {
371+ redrawCanvas ( layerdict ) ;
372+ }
369373}
370374
371375function handleMouseWheel ( e , layerdict ) {
@@ -408,6 +412,11 @@ function addMouseHandlers(div, layerdict) {
408412 }
409413}
410414
415+ function setRedrawOnDrag ( value ) {
416+ redrawOnDrag = value ;
417+ writeStorage ( "redrawOnDrag" , value ) ;
418+ }
419+
411420function initRender ( ) {
412421 allcanvas = {
413422 front : {
0 commit comments