Aligned renderer
This commit is contained in:
parent
136ffa55fc
commit
6ae606d876
@ -1,18 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
function Dotgrid (width, height) {
|
||||
this.controller = null
|
||||
|
||||
const defaultTheme = { background: '#eee', f_high: '#000', f_med: '#999', f_low: '#ccc', f_inv: '#000', b_high: '#000', b_med: '#888', b_low: '#aaa', b_inv: '#ffb545' }
|
||||
|
||||
this.theme = new Theme(defaultTheme)
|
||||
this.history = new History()
|
||||
|
||||
this.grid = { x: 20, y: 20, width: 0, height: 0 }
|
||||
|
||||
// ISU
|
||||
|
||||
this.install = function (host) {
|
||||
this.theme = new Theme(defaultTheme)
|
||||
this.history = new History()
|
||||
this.manager = new Manager(this)
|
||||
this.renderer = new Renderer(this)
|
||||
this.tool = new Tool(this)
|
||||
@ -121,8 +118,8 @@ function Dotgrid (width, height) {
|
||||
this.grid = {
|
||||
x: size.width / 15,
|
||||
y: size.height / 15,
|
||||
width: this.tool.settings.size.width / size.width / 15,
|
||||
height: this.tool.settings.size.height / size.height / 15
|
||||
width: 15,
|
||||
height: 15
|
||||
}
|
||||
|
||||
this.renderer.resize(size)
|
||||
@ -169,12 +166,11 @@ function Dotgrid (width, height) {
|
||||
|
||||
this.grid = {
|
||||
x: size.width / 15,
|
||||
y: size.height / 15
|
||||
y: size.height / 15,
|
||||
width: 15,
|
||||
height: 15
|
||||
}
|
||||
|
||||
this.grid.width = this.tool.settings.size.width / this.grid.x
|
||||
this.grid.height = this.tool.settings.size.height / this.grid.y
|
||||
|
||||
this.renderer.resize(size)
|
||||
|
||||
document.title = `Dotgrid — ${size.width}x${size.height}`
|
||||
|
@ -23,8 +23,8 @@ function Renderer (dotgrid) {
|
||||
|
||||
this.drawMirror()
|
||||
this.drawRulers()
|
||||
this.drawRender() //
|
||||
this.drawGrid()
|
||||
this.drawRender() //
|
||||
this.drawVertices()
|
||||
this.drawHandles()
|
||||
this.drawTranslation()
|
||||
@ -255,13 +255,13 @@ function Renderer (dotgrid) {
|
||||
this.drawRender = function () {
|
||||
let img = new Image()
|
||||
img.src = dotgrid.manager.svg64()
|
||||
this.context.drawImage(img, 0, 0, this.el.width, this.el.height)
|
||||
this.context.drawImage(img, 0, 0, this.el.width - 30, this.el.height - 30)
|
||||
}
|
||||
|
||||
this.drawDebug = function () {
|
||||
this.context.strokeRect(0, 0, this.el.width, this.el.height)
|
||||
this.context.strokeRect(this.el.width / 2, 0, this.el.width, this.el.height)
|
||||
this.context.strokeRect(0, this.el.height / 2, this.el.width, this.el.height)
|
||||
this.context.strokeRect((this.el.width / 2) + 15, 0, this.el.width, this.el.height)
|
||||
this.context.strokeRect(0, (this.el.height / 2) + 15, this.el.width, this.el.height)
|
||||
}
|
||||
|
||||
function isEqual (a, b) { return a && b && Math.abs(a.x) == Math.abs(b.x) && Math.abs(a.y) == Math.abs(b.y) }
|
||||
|
Loading…
Reference in New Issue
Block a user