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

@ -7,7 +7,7 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_regular
#ronin #wrapper #commander { z-index: 9000;position: relative;width: calc(50vw - 30px);height: calc(100vh - 60px);-webkit-app-region: no-drag;padding-right: 30px;transition: margin-left 250ms;} #ronin #wrapper #commander { z-index: 9000;position: relative;width: calc(50vw - 30px);height: calc(100vh - 60px);-webkit-app-region: no-drag;padding-right: 30px;transition: margin-left 250ms;}
#ronin #wrapper #commander textarea { background: none; width: 100%; height: calc(100vh - 105px); resize: none; font-size: 12px;line-height: 15px; padding-right: 15px} #ronin #wrapper #commander textarea { background: none; width: 100%; height: calc(100vh - 105px); resize: none; font-size: 12px;line-height: 15px; padding-right: 15px}
#ronin #wrapper #commander #status { position: absolute; bottom: 0px; text-transform: lowercase; line-height: 15px; height: 30px; overflow: hidden; width: calc(100% - 30px);} #ronin #wrapper #commander #status { position: absolute; bottom: 0px; text-transform: lowercase; line-height: 15px; height: 30px; overflow: hidden; width: calc(100% - 30px);}
#ronin #wrapper #commander #source { position: absolute;right: 0px;bottom: 0px; } #ronin #wrapper #commander #status #source { position: absolute;right: 0px;bottom: 0px; white-space: pre}
#ronin.expand #wrapper #commander { width:100%; } #ronin.expand #wrapper #commander { width:100%; }
#ronin #surface,#ronin #guide { position: absolute; top:0px; -webkit-user-select: none;-webkit-app-region: no-drag; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><circle cx='10' cy='10' r='1' fill='%23555'></circle></svg>"); background-size: 10px 10px; background-position: -4px -4px; width:100%; height:100%; transition: left 250ms} #ronin #surface,#ronin #guide { position: absolute; top:0px; -webkit-user-select: none;-webkit-app-region: no-drag; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><circle cx='10' cy='10' r='1' fill='%23555'></circle></svg>"); background-size: 10px 10px; background-position: -4px -4px; width:100%; height:100%; transition: left 250ms}

View File

@ -82,7 +82,8 @@ function Commander (ronin) {
// console.log(msg) // console.log(msg)
} }
// Source // 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) { if (_source !== this._source.textContent) {
this._source.textContent = _source this._source.textContent = _source
} }

View File

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