Improved editor
This commit is contained in:
@@ -31,6 +31,7 @@ function Commander (ronin) {
|
||||
}
|
||||
|
||||
this.run = (txt = this._input.value) => {
|
||||
if (this._input.value.indexOf('$') > -1) { console.warn('$ is present.'); return }
|
||||
ronin.bindings = {}
|
||||
ronin.surface.maximize()
|
||||
ronin.interpreter.run(txt)
|
||||
|
||||
@@ -86,6 +86,7 @@ function Ronin () {
|
||||
this.bindings[id](shape)
|
||||
}
|
||||
this.commander.capture()
|
||||
this.surface.clearGuide()
|
||||
this.surface.drawGuide(shape)
|
||||
}
|
||||
|
||||
@@ -97,6 +98,7 @@ function Ronin () {
|
||||
}
|
||||
if (this.mouseOrigin) {
|
||||
this.commander.commit(shape, false)
|
||||
this.surface.clearGuide()
|
||||
this.surface.drawGuide(shape)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,13 @@ function Surface (ronin) {
|
||||
if (isLine(shape)) {
|
||||
this.context.drawImage(img, shape.a.x, shape.a.y, shape.b.x - shape.a.x, shape.b.y - shape.a.y)
|
||||
} else if (isRect(shape)) {
|
||||
this.context.drawImage(img, shape.x, shape.y, shape.w, img.height * (shape.w / img.width))
|
||||
if (img.width > img.height) {
|
||||
console.log('w bigger')
|
||||
this.context.drawImage(img, shape.x, shape.y, shape.w, img.height * (shape.w / img.width))
|
||||
} else {
|
||||
console.log('h bigger')
|
||||
this.context.drawImage(img, shape.x, shape.y, img.width * (shape.h / img.height), shape.h)
|
||||
}
|
||||
} else {
|
||||
this.context.drawImage(img, shape.x, shape.y, img.width, img.height)
|
||||
}
|
||||
@@ -167,7 +173,6 @@ function Surface (ronin) {
|
||||
}
|
||||
|
||||
this.drawGuide = function (shape, context = this.guide) {
|
||||
this.clearGuide()
|
||||
if (!shape) { return }
|
||||
this.stroke(shape.rect || shape, 3, 'black', context)
|
||||
if (shape.line) { this.stroke(shape.line, 3, 'black', context) }
|
||||
|
||||
Reference in New Issue
Block a user