Aligned renderer
This commit is contained in:
parent
136ffa55fc
commit
6ae606d876
@ -1,18 +1,15 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
function Dotgrid (width, height) {
|
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' }
|
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 }
|
this.grid = { x: 20, y: 20, width: 0, height: 0 }
|
||||||
|
|
||||||
// ISU
|
// ISU
|
||||||
|
|
||||||
this.install = function (host) {
|
this.install = function (host) {
|
||||||
|
this.theme = new Theme(defaultTheme)
|
||||||
|
this.history = new History()
|
||||||
this.manager = new Manager(this)
|
this.manager = new Manager(this)
|
||||||
this.renderer = new Renderer(this)
|
this.renderer = new Renderer(this)
|
||||||
this.tool = new Tool(this)
|
this.tool = new Tool(this)
|
||||||
@ -121,8 +118,8 @@ function Dotgrid (width, height) {
|
|||||||
this.grid = {
|
this.grid = {
|
||||||
x: size.width / 15,
|
x: size.width / 15,
|
||||||
y: size.height / 15,
|
y: size.height / 15,
|
||||||
width: this.tool.settings.size.width / size.width / 15,
|
width: 15,
|
||||||
height: this.tool.settings.size.height / size.height / 15
|
height: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderer.resize(size)
|
this.renderer.resize(size)
|
||||||
@ -169,12 +166,11 @@ function Dotgrid (width, height) {
|
|||||||
|
|
||||||
this.grid = {
|
this.grid = {
|
||||||
x: size.width / 15,
|
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)
|
this.renderer.resize(size)
|
||||||
|
|
||||||
document.title = `Dotgrid — ${size.width}x${size.height}`
|
document.title = `Dotgrid — ${size.width}x${size.height}`
|
||||||
|
@ -23,8 +23,8 @@ function Renderer (dotgrid) {
|
|||||||
|
|
||||||
this.drawMirror()
|
this.drawMirror()
|
||||||
this.drawRulers()
|
this.drawRulers()
|
||||||
this.drawRender() //
|
|
||||||
this.drawGrid()
|
this.drawGrid()
|
||||||
|
this.drawRender() //
|
||||||
this.drawVertices()
|
this.drawVertices()
|
||||||
this.drawHandles()
|
this.drawHandles()
|
||||||
this.drawTranslation()
|
this.drawTranslation()
|
||||||
@ -255,13 +255,13 @@ function Renderer (dotgrid) {
|
|||||||
this.drawRender = function () {
|
this.drawRender = function () {
|
||||||
let img = new Image()
|
let img = new Image()
|
||||||
img.src = dotgrid.manager.svg64()
|
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.drawDebug = function () {
|
||||||
this.context.strokeRect(0, 0, this.el.width, this.el.height)
|
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((this.el.width / 2) + 15, 0, this.el.width, this.el.height)
|
||||||
this.context.strokeRect(0, this.el.height / 2, 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) }
|
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