Move rows/columns variables to SilicaDocument
This commit is contained in:
parent
ac740e653a
commit
beac4f568e
2 changed files with 15 additions and 15 deletions
|
@ -19,12 +19,6 @@ class Document: NSDocument {
|
||||||
|
|
||||||
var info = SilicaDocument()
|
var info = SilicaDocument()
|
||||||
|
|
||||||
var rows: Int = 0
|
|
||||||
var columns: Int = 0
|
|
||||||
|
|
||||||
var remainderWidth: Int = 0
|
|
||||||
var remainderHeight: Int = 0
|
|
||||||
|
|
||||||
struct SilicaParsingError: Error, LocalizedError {
|
struct SilicaParsingError: Error, LocalizedError {
|
||||||
enum Kind {
|
enum Kind {
|
||||||
case invalid
|
case invalid
|
||||||
|
@ -97,12 +91,12 @@ class Document: NSDocument {
|
||||||
var width: Int = info.tileSize
|
var width: Int = info.tileSize
|
||||||
var height: Int = info.tileSize
|
var height: Int = info.tileSize
|
||||||
|
|
||||||
if((x + 1) == columns) {
|
if((x + 1) == info.columns) {
|
||||||
width = info.tileSize - remainderWidth
|
width = info.tileSize - info.remainderWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
if(y == rows) {
|
if(y == info.rows) {
|
||||||
height = info.tileSize - remainderHeight
|
height = info.tileSize - info.remainderHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
return (width, height)
|
return (width, height)
|
||||||
|
@ -139,7 +133,7 @@ class Document: NSDocument {
|
||||||
|
|
||||||
let (width, height) = getTileSize(x, y)
|
let (width, height) = getTileSize(x, y)
|
||||||
|
|
||||||
if y == rows {
|
if y == info.rows {
|
||||||
y = 0
|
y = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,15 +409,15 @@ class Document: NSDocument {
|
||||||
info.width = width
|
info.width = width
|
||||||
info.height = height
|
info.height = height
|
||||||
|
|
||||||
columns = Int(ceil(Float(info.width) / Float(info.tileSize)))
|
info.columns = Int(ceil(Float(info.width) / Float(info.tileSize)))
|
||||||
rows = Int(ceil(Float(info.height) / Float(info.tileSize))) + 1 // TODO: lol why
|
info.rows = Int(ceil(Float(info.height) / Float(info.tileSize))) + 1 // TODO: lol why
|
||||||
|
|
||||||
if info.width % info.tileSize != 0 {
|
if info.width % info.tileSize != 0 {
|
||||||
remainderWidth = (columns * info.tileSize) - info.width
|
info.remainderWidth = (info.columns * info.tileSize) - info.width
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.height % info.tileSize != 0 {
|
if info.height % info.tileSize != 0 {
|
||||||
remainderHeight = (rows * info.tileSize) - info.height
|
info.remainderHeight = (info.rows * info.tileSize) - info.height
|
||||||
}
|
}
|
||||||
|
|
||||||
let layersClassKey = dict[LayersKey]
|
let layersClassKey = dict[LayersKey]
|
||||||
|
|
|
@ -77,6 +77,12 @@ struct SilicaDocument {
|
||||||
var width: Int = 0
|
var width: Int = 0
|
||||||
var height: Int = 0
|
var height: Int = 0
|
||||||
|
|
||||||
|
var rows: Int = 0
|
||||||
|
var columns: Int = 0
|
||||||
|
|
||||||
|
var remainderWidth: Int = 0
|
||||||
|
var remainderHeight: Int = 0
|
||||||
|
|
||||||
var layers: [SilicaLayer] = []
|
var layers: [SilicaLayer] = []
|
||||||
|
|
||||||
var videoFrame: (Int, Int) = (0, 0)
|
var videoFrame: (Int, Int) = (0, 0)
|
||||||
|
|
Reference in a new issue