MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / make14Graph

Function make14Graph

lib/web/drags.js:936–1001  ·  view source on GitHub ↗
(rrRaph, w, h, get, setAndConstrain)

Source from the content-addressed store, hash-verified

934
935
936var make14Graph = function (rrRaph, w, h, get, setAndConstrain) {
937 var vz = get();
938
939 console.log(" initial value for 4 graph is " + stringify(vz));
940
941 var curve = rrRaph.path().attr({"stroke-width": 4, "stroke": "#000"});
942 var curve2 = rrRaph.path().attr({"stroke-width": 1, "stroke": "#555"});
943
944 var updatePath = function () {
945 var z = "M" + (0 * (w - insetW * 2) + insetW) + "," + (vz[0] * (h - insetW * 2) + insetW);
946 z += "C " + (0.3333 * (w - insetW * 2) + insetW) + "," + (vz[1] * (h - insetW * 2) + insetW);
947 z += " " + (0.6666 * (w - insetW * 2) + insetW) + "," + (vz[2] * (h - insetW * 2) + insetW);
948 z += " " + (1 * (w - insetW * 2) + insetW) + "," + (vz[3] * (h - insetW * 2) + insetW);
949 curve.attr({path: z});
950
951 z = "M" + (0 * (w - insetW * 2) + insetW) + "," + (vz[0] * (h - insetW * 2) + insetW);
952 z += "L " + (0.3333 * (w - insetW * 2) + insetW) + "," + (vz[1] * (h - insetW * 2) + insetW);
953 z += "M" + (0.6666 * (w - insetW * 2) + insetW) + "," + (vz[2] * (h - insetW * 2) + insetW);
954 z += "L" + (1 * (w - insetW * 2) + insetW) + "," + (vz[3] * (h - insetW * 2) + insetW);
955 curve2.attr({path: z})
956 };
957 var s0 = makeXYSlider(rrRaph, w, h, function () {
958 vz = get();
959 return [0, vz[0]]
960 }, function (o, p, n) {
961 n[0] = 0;
962 vz[0] = n[1];
963 updatePath();
964 q = setAndConstrain(vz, vz, vz);
965 return [0, q[0]];
966 }, true, false);
967 var s1 = makeXYSlider(rrRaph, w, h, function () {
968 vz = get();
969 return [0.3333, vz[1]]
970 }, function (o, p, n) {
971 n[0] = 0.3333;
972 vz[1] = n[1];
973 updatePath();
974 q = setAndConstrain(vz, vz, vz);
975 return [0.3333, q[1]];
976 }, false, false);
977 var s2 = makeXYSlider(rrRaph, w, h, function () {
978 vz = get();
979 return [0.6666, vz[2]]
980 }, function (o, p, n) {
981 n[0] = 0.6666;
982 vz[2] = n[1];
983 updatePath();
984 q = setAndConstrain(vz, vz, vz);
985 return [0.6666, q[2]];
986 }, false, false);
987 var s3 = makeXYSlider(rrRaph, w, h, function () {
988 vz = get();
989 return [1, vz[3]]
990 }, function (o, p, n) {
991 n[0] = 1;
992 vz[3] = n[1];
993 updatePath();

Callers 1

insert14GraphSliderFunction · 0.85

Calls 7

makeXYSliderFunction · 0.85
updatePathFunction · 0.85
logMethod · 0.80
pathMethod · 0.80
getFunction · 0.70
stringifyFunction · 0.70
attrMethod · 0.45

Tested by

no test coverage detected