Use right-click for helpers

This commit is contained in:
Devine Lu Linvega 2019-07-27 13:07:56 +09:00
parent 8189d51912
commit b844cbbc17
3 changed files with 10 additions and 4 deletions

View File

@ -27,6 +27,10 @@ npm start
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW.jpg' width='600'/>
## Buttons
- Holding right-click while using $helpers will run the script as the mouse is used.
## Library
Additional functions can be found in the [includes](https://github.com/hundredrabbits/Ronin/tree/master/desktop/sources/lisp), you can also look at the [examples](https://github.com/hundredrabbits/Ronin/tree/master/examples) to see them in action.

View File

@ -119,7 +119,7 @@ function Commander (ronin) {
this._input.value = this._input.value.replace('$path', `"${path}"`)
}
this.commit = function (shape, end = false) {
this.commit = function (shape, end = false, run = false) {
if (this.cache.indexOf('$') < 0) { return }
const segs = this.cache.split('$')
const seg = segs[1]
@ -144,7 +144,9 @@ function Commander (ronin) {
if (end === true) {
this.cache = this._input.value
}
this.run()
if (run === true) {
this.run()
}
}
// Display

View File

@ -97,7 +97,7 @@ function Ronin () {
this.bindings[id](shape)
}
if (this.mouseOrigin) {
this.commander.commit(shape, false)
this.commander.commit(shape, false, e.which !== 1)
this.surface.clearGuide()
this.surface.drawGuide(shape)
}
@ -110,7 +110,7 @@ function Ronin () {
this.bindings[id](shape)
}
if (this.mouseOrigin) {
this.commander.commit(shape, true)
this.commander.commit(shape, true, e.which !== 1)
}
this.mouseOrigin = null
this.surface.clearGuide()