Removed old paddings
This commit is contained in:
@@ -90,8 +90,8 @@ function Cursor () {
|
||||
|
||||
this.snapPos = function (pos) {
|
||||
return {
|
||||
x: clamp(step(pos.x, 15), 15, dotgrid.tool.settings.size.width),
|
||||
y: clamp(step(pos.y, 15), 15, dotgrid.tool.settings.size.height)
|
||||
x: clamp(step(pos.x, 15), 0, dotgrid.tool.settings.size.width),
|
||||
y: clamp(step(pos.y, 15), 0, dotgrid.tool.settings.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ function Dotgrid () {
|
||||
}
|
||||
|
||||
this.getPadding = function () {
|
||||
return { x: 60, y: 120 }
|
||||
return { x: 60, y: 90 }
|
||||
}
|
||||
|
||||
this.getWindowSize = function () {
|
||||
|
||||
@@ -10,8 +10,8 @@ function Generator (layer, style) {
|
||||
for (const k1 in l) {
|
||||
const seg = l[k1]
|
||||
for (const k2 in seg.vertices) {
|
||||
if (mirror === 1 || mirror === 3) { seg.vertices[k2].x = (dotgrid.tool.settings.size.width) - seg.vertices[k2].x + 15 }
|
||||
if (mirror === 2 || mirror === 3) { seg.vertices[k2].y = (dotgrid.tool.settings.size.height) - seg.vertices[k2].y + 15 }
|
||||
if (mirror === 1 || mirror === 3) { seg.vertices[k2].x = (dotgrid.tool.settings.size.width) - seg.vertices[k2].x }
|
||||
if (mirror === 2 || mirror === 3) { seg.vertices[k2].y = (dotgrid.tool.settings.size.height) - seg.vertices[k2].y }
|
||||
|
||||
// Offset
|
||||
seg.vertices[k2].x += offset.x
|
||||
|
||||
@@ -19,10 +19,10 @@ function Manager (dotgrid) {
|
||||
}
|
||||
|
||||
this.update = function () {
|
||||
this.el.setAttribute('width', (dotgrid.tool.settings.size.width + 15) + 'px')
|
||||
this.el.setAttribute('height', (dotgrid.tool.settings.size.height + 15) + 'px')
|
||||
this.el.style.width = (dotgrid.tool.settings.size.width + 15)
|
||||
this.el.style.height = dotgrid.tool.settings.size.height + 15
|
||||
this.el.setAttribute('width', (dotgrid.tool.settings.size.width) + 'px')
|
||||
this.el.setAttribute('height', (dotgrid.tool.settings.size.height) + 'px')
|
||||
this.el.style.width = (dotgrid.tool.settings.size.width)
|
||||
this.el.style.height = dotgrid.tool.settings.size.height
|
||||
|
||||
const styles = dotgrid.tool.styles
|
||||
const paths = dotgrid.tool.paths()
|
||||
|
||||
@@ -51,13 +51,12 @@ function Renderer (dotgrid) {
|
||||
|
||||
this.resize = function () {
|
||||
const _target = dotgrid.getPaddedSize()
|
||||
const _current = {width:this.el.width/this.scale,height:this.el.height/this.scale}
|
||||
const offset = sizeOffset(_target,_current)
|
||||
if(offset.width === 0 && offset.height === 0){
|
||||
const _current = { width: this.el.width / this.scale, height: this.el.height / this.scale }
|
||||
const offset = sizeOffset(_target, _current)
|
||||
if (offset.width === 0 && offset.height === 0) {
|
||||
return
|
||||
}
|
||||
console.log('Renderer',`Require resize: ${printSize(_target)}, from ${printSize(_current)}`)
|
||||
// const pad = 15
|
||||
console.log('Renderer', `Require resize: ${printSize(_target)}, from ${printSize(_current)}`)
|
||||
this.el.width = (_target.width) * this.scale
|
||||
this.el.height = (_target.height) * this.scale
|
||||
this.el.style.width = (_target.width) + 'px'
|
||||
@@ -107,15 +106,18 @@ function Renderer (dotgrid) {
|
||||
|
||||
for (let x = markers.w - 1; x >= 0; x--) {
|
||||
for (let y = markers.h - 1; y >= 0; y--) {
|
||||
let is_step = x % 4 === 0 && y % 4 === 0
|
||||
let isStep = x % 4 === 0 && y % 4 === 0
|
||||
|
||||
// Don't draw margins
|
||||
if (x === 0 || y === 0) { continue }
|
||||
// Color
|
||||
let color = is_step ? dotgrid.theme.active.b_med : dotgrid.theme.active.b_low
|
||||
let color = isStep ? dotgrid.theme.active.b_med : dotgrid.theme.active.b_low
|
||||
if ((y === 0 || y === markers.h) && cursor.x === x + 1) { color = dotgrid.theme.active.b_high } else if ((x === 0 || x === markers.w - 1) && cursor.y === y + 1) { color = dotgrid.theme.active.b_high } else if (cursor.x === x + 1 && cursor.y === y + 1) { color = dotgrid.theme.active.b_high }
|
||||
|
||||
this.drawMarker({
|
||||
x: parseInt(x * 15) + 15,
|
||||
y: parseInt(y * 15) + 15
|
||||
}, is_step ? 2.5 : 1.5, color)
|
||||
x: parseInt(x * 15),
|
||||
y: parseInt(y * 15)
|
||||
}, isStep ? 2.5 : 1.5, color)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +271,7 @@ function Renderer (dotgrid) {
|
||||
}
|
||||
|
||||
function printSize (size) { return `${size.width}x${size.height}` }
|
||||
function sizeOffset(a,b){ return { width: a.width - b.width, height: a.height - b.height } }
|
||||
function sizeOffset (a, b) { return { width: a.width - b.width, height: a.height - b.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 clamp (v, min, max) { return v < min ? min : v > max ? max : v }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user