This commit is contained in:
Devine Lu Linvega
2018-10-03 15:29:46 +12:00
parent 3879dd794c
commit a8628139a0
5 changed files with 13 additions and 16 deletions

View File

@@ -85,7 +85,6 @@ function Generator(layer,style)
s += `${this.render(prev,seg,mirror)}`
prev = seg.vertices ? seg.vertices[seg.vertices.length-1] : null
}
return s;
}

View File

@@ -85,7 +85,7 @@ function Guide()
{
if(!this.show_extras){ return; }
let cursor = {x:parseInt(dotgrid.cursor.pos.x/dotgrid.grid_width),y:parseInt(dotgrid.cursor.pos.y/dotgrid.grid_width)}
const cursor = {x:parseInt(dotgrid.cursor.pos.x/dotgrid.grid_width),y:parseInt(dotgrid.cursor.pos.y/dotgrid.grid_width)}
for (let x = dotgrid.grid_x-1; x >= 0; x--) {
for (let y = dotgrid.grid_y; y >= 0; y--) {

View File

@@ -47,9 +47,9 @@ function Interface()
}
for(const type in options){
let tools = options[type];
const tools = options[type];
for(const name in tools){
let tool = tools[name];
const tool = tools[name];
html += `
<svg
id="option_${name}"
@@ -106,7 +106,7 @@ function Interface()
let multi_vertices = null;
let segments = dotgrid.tool.layer()
let sum_segments = dotgrid.tool.length();
const sum_segments = dotgrid.tool.length();
for(const i in segments){
if(segments[i].vertices.length > 2){ multi_vertices = true; break; }

View File

@@ -2,7 +2,7 @@
function Theme(default_theme = {background: "#222", f_high: "#fff", f_med: "#ccc", f_low: "#999", f_inv: "#fff", b_high: "#888", b_med: "#666", b_low: "#444", b_inv: "#000" })
{
let themer = this;
const themer = this;
this.el = document.createElement("style")
this.el.type = 'text/css'
@@ -26,7 +26,7 @@ function Theme(default_theme = {background: "#222", f_high: "#fff", f_med: "#ccc
this.start = function()
{
console.log("Theme","Starting..")
let storage = is_json(localStorage.theme) ? JSON.parse(localStorage.theme) : this.collection.default;
const storage = is_json(localStorage.theme) ? JSON.parse(localStorage.theme) : this.collection.default;
this.load(!storage.background ? this.collection.default : storage)
}
@@ -67,8 +67,6 @@ function Theme(default_theme = {background: "#222", f_high: "#fff", f_med: "#ccc
this.parse = function(any)
{
let theme;
if(any && any.background){ return any; }
else if(any && any.data){ return any.data; }
else if(any && is_json(any)){ return JSON.parse(any); }
@@ -79,7 +77,7 @@ function Theme(default_theme = {background: "#222", f_high: "#fff", f_med: "#ccc
this.extract = function(text)
{
let svg = new DOMParser().parseFromString(text,"text/xml")
const svg = new DOMParser().parseFromString(text,"text/xml")
try{
return {
@@ -135,12 +133,12 @@ function Theme(default_theme = {background: "#222", f_high: "#fff", f_med: "#ccc
e.preventDefault();
e.stopPropagation();
let file = e.dataTransfer.files[0];
const file = e.dataTransfer.files[0];
if(!file || !file.name){ console.warn("Theme","Unnamed file."); return; }
if(file.name.indexOf(".thm") < 0 && file.name.indexOf(".svg") < 0){ console.warn("Theme","Skipped, not a theme"); return; }
let reader = new FileReader();
const reader = new FileReader();
reader.onload = function(e){
themer.load(themer.parse(e.target.result));
};

View File

@@ -33,7 +33,7 @@ function Picker()
if(!this.is_active){ return; }
if(!is_color(this.input.value)){ return; }
let hex = `#${this.input.value}`;
const hex = `#${this.input.value}`;
document.getElementById("option_color").children[0].style.fill = hex;
document.getElementById("option_color").children[0].style.stroke = hex;
@@ -59,7 +59,7 @@ function Picker()
{
if(!is_color(this.input.value)){ return; }
let hex = `#${this.input.value}`;
const hex = `#${this.input.value}`;
dotgrid.tool.style().color = hex;
dotgrid.tool.style().fill = dotgrid.tool.style().fill != "none" ? hex : "none";
@@ -95,13 +95,13 @@ function Picker()
return false
}
let re = /[0-9A-Fa-f]/g;
const re = /[0-9A-Fa-f]/g;
return re.test(val)
}
function is_color_char(val)
{
let re = /[0-9A-Fa-f]/g;
const re = /[0-9A-Fa-f]/g;
return re.test(val)
}