diff --git a/README.md b/README.md index b360c06..14a8b0d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The repl has the following syntax (It's work in progress, new capabilities will * remove(x) removes bindings (when it's an object (eg vector), removes it from the matrix) * remove(@x) removes an object using it's assigned index * method calls: - * a = vector(0,0,12,1) + * a = vector(12,1) > > vector@0{x0:1, y0: 2, x:12, y:1} * a.type() > > vector @@ -33,9 +33,9 @@ The repl has the following syntax (It's work in progress, new capabilities will * cmdline: npm run start * enter the following: ``` - a=vector(0,0,0.5,0.5) - b=vector(0,0,-1,1) - c="a+b" + a = vector(0.5, 0.5) + b = vector(-1, 1) + c = "a+b" ``` * and press enter. Then using the mouse pointer move a or b. * or type help() \ No newline at end of file diff --git a/screenshot.png b/screenshot.png index 1a5273d..f481a14 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/src/js/console.js b/src/js/console.js index f1f6937..00270fa 100644 --- a/src/js/console.js +++ b/src/js/console.js @@ -205,7 +205,13 @@ const method_call = function (object_wrapper, method_or_property) { const functions = { help: () => help(), - vector: (args) => create_vector({x0: args[0], y0: args[1], x: args[2], y: args[3]}), + vector: (args) => { + if (args.length === 2) { + return create_vector({x0: 0, y0: 0, x: args[0], y: args[1]}); + } else { + return create_vector({x0: args[0], y0: args[1], x: args[2], y: args[3]}); + } + }, remove: (args) => { if (Object.prototype.hasOwnProperty.call(args[0], ['binding'])) { delete state[args[0].binding];