Display file size in terface

This commit is contained in:
Devine Lu Linvega
2019-07-28 09:31:05 +09:00
parent b07dfb214b
commit 2be2e8861c
3 changed files with 3 additions and 4 deletions

View File

@@ -82,7 +82,8 @@ function Commander (ronin) {
// console.log(msg)
}
// Source
const _source = `${ronin.source}[${this._input.value.split('\n').length}]`
const rect = ronin.surface.getFrame()
const _source = `${ronin.source}[${this._input.value.split('\n').length}]\n${rect.w}x${rect.h}`
if (_source !== this._source.textContent) {
this._source.textContent = _source
}

View File

@@ -137,7 +137,6 @@ function Surface (ronin) {
img.src = path
img.onload = () => {
const rect = { x: 0, y: 0, w: parseInt(img.width * ratio), h: parseInt(img.height * ratio) }
ronin.log(`Open ${rect.w}x${rect.h}`)
this.resize(rect, true)
this.context.drawImage(img, 0, 0, rect.w, rect.h)
resolve()
@@ -148,7 +147,6 @@ function Surface (ronin) {
this.draw = function (img, shape = this.getFrame()) {
return new Promise(resolve => {
img.onload = () => {
ronin.log(`Draw ${img.width}x${img.height}`)
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)) {