(o, p, x)
| 464 | return val; |
| 465 | }; |
| 466 | var set = function (o, p, x) { |
| 467 | // update in animation? |
| 468 | |
| 469 | console.log(" x-p = " + (x - p)); |
| 470 | |
| 471 | var s = start.find() |
| 472 | var e = end.find() |
| 473 | |
| 474 | var text = cm.getDoc().getRange(s, e) |
| 475 | |
| 476 | var currentDP = numDP(text); |
| 477 | |
| 478 | var nextVal = "" + (parseFloat(text) + 4 * (Math.abs(parseFloat(text)) + Math.pow(10, -currentDP)) * (x - p)).toFixed(Math.max(2, currentDP - 1)) |
| 479 | |
| 480 | while (numDP(nextVal) > currentDP && nextVal.charAt(nextVal.length - 1) == '0') |
| 481 | nextVal = nextVal.substring(0, nextVal.length - 1) |
| 482 | |
| 483 | console.log(nextVal); |
| 484 | console.log(s); |
| 485 | console.log(e); |
| 486 | |
| 487 | nextVal = "" + nextVal |
| 488 | text = "" + text |
| 489 | |
| 490 | if (nextVal.endsWith(".") && !text.endsWith(".")) nextVal = nextVal.substring(0, nextVal.length - 1); |
| 491 | |
| 492 | |
| 493 | |
| 494 | if (text != nextVal) { |
| 495 | cm.getDoc().replaceRange(nextVal, s, e); |
| 496 | |
| 497 | var f = findEnclosingPathForLine(onWord.line); |
| 498 | if (f != null) { |
| 499 | executeBracket(f, true) |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | val = x; |
| 504 | return val; |
| 505 | }; |
| 506 | |
| 507 | var up = function () { |
| 508 | return 0.5; |
no test coverage detected