diff --git a/htdocs/js/GraphTool/sinewavetool.js b/htdocs/js/GraphTool/sinewavetool.js index 94e8ce576..d401f2b9a 100644 --- a/htdocs/js/GraphTool/sinewavetool.js +++ b/htdocs/js/GraphTool/sinewavetool.js @@ -25,6 +25,17 @@ this.focusPoint = shiftPoint; }, + updateTextCoords(gt, coords) { + for (const point of this.definingPts) { + if (point.dragged || point.hasPoint(coords.scrCoords[1], coords.scrCoords[2])) { + delete point.dragged; + gt.setTextCoords(point.X(), point.Y()); + return true; + } + } + return false; + }, + stringify(gt) { return [ this.baseObj.getAttribute('dash') == 0 ? 'solid' : 'dashed', @@ -183,6 +194,8 @@ if (shiftPoint) periodPoint?.setPosition(JXG.COORDS_BY_USER, [periodPoint.X(), shiftPoint.Y()]); + if (e.type === 'pointermove') this.dragged = true; + gt.updateObjects(); gt.updateText(); },