Implemented (resize (rect))
This commit is contained in:
parent
ab3d959335
commit
3b59441033
@ -26,6 +26,11 @@ function Library (ronin) {
|
|||||||
return rect
|
return rect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.resize = (rect) => {
|
||||||
|
ronin.surface.resize(rect, true)
|
||||||
|
return rect
|
||||||
|
}
|
||||||
|
|
||||||
this.select = (rect = this.frame()) => {
|
this.select = (rect = this.frame()) => {
|
||||||
return ronin.surface.select(rect)
|
return ronin.surface.select(rect)
|
||||||
}
|
}
|
||||||
@ -132,13 +137,15 @@ function Library (ronin) {
|
|||||||
return { a, b, t }
|
return { a, b, t }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.text = (x, y, g, s, f = 'Arial', t = 'text') => {
|
||||||
|
return { x, y, g, s, f, t }
|
||||||
|
}
|
||||||
|
|
||||||
this.svg = (d, t = 'svg') => {
|
this.svg = (d, t = 'svg') => {
|
||||||
return { d, t }
|
return { d, t }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.text = (x, y, g, s, f = 'Arial', t = 'text') => {
|
// Helpers
|
||||||
return { x, y, g, s, f, t }
|
|
||||||
}
|
|
||||||
|
|
||||||
this.frame = () => {
|
this.frame = () => {
|
||||||
return ronin.surface.getFrame()
|
return ronin.surface.getFrame()
|
||||||
|
@ -150,7 +150,7 @@ function Surface (ronin) {
|
|||||||
this.context.drawImage(this.el, a.x, a.y, a.w, a.h, b.x, b.y, b.w, b.h)
|
this.context.drawImage(this.el, a.x, a.y, a.w, a.h, b.x, b.y, b.w, b.h)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resize = function (size) {
|
this.resize = function (size, fit = false) {
|
||||||
this.el.width = size.w
|
this.el.width = size.w
|
||||||
this.el.height = size.h
|
this.el.height = size.h
|
||||||
this.el.style.width = size.w + 'px'
|
this.el.style.width = size.w + 'px'
|
||||||
@ -159,6 +159,15 @@ function Surface (ronin) {
|
|||||||
this._guide.height = size.h
|
this._guide.height = size.h
|
||||||
this._guide.style.width = size.w + 'px'
|
this._guide.style.width = size.w + 'px'
|
||||||
this._guide.style.height = size.h + 'px'
|
this._guide.style.height = size.h + 'px'
|
||||||
|
if (fit === true) {
|
||||||
|
this.fitWindow(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fitWindow = function (size) {
|
||||||
|
const win = require('electron').remote.getCurrentWindow()
|
||||||
|
const pad = { w: 60, h: 60 }
|
||||||
|
win.setSize(size.w + pad.w, size.h + pad.h, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maximize = function () {
|
this.maximize = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user