diff --git a/CHANGELOG.md b/CHANGELOG.md index a0773cc..409e076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,3 +19,8 @@ - Se agrega analytics al proyecto - Se agrega la posibilidad de subir diagrama con sus formas para ayudar a mejorar la detección de formas - Se agregan funciones de procesamiento al repositorio + + +## 1.1.0 +- Se agrega la capacidad de cambiar el tamaño de letra y de desactivar el ajuste automático de escala, junto con la capacidad de elegirlo manualmente +- Se agrega api_key para compilador de C diff --git a/public/css/main.css b/public/css/main.css index 0068584..4fa4c5e 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -124,6 +124,7 @@ footer a:hover { /* EDIT */ +.drophidden .dropdown-toggle::before, .drophidden .dropdown-toggle::after { content: none; } @@ -147,6 +148,20 @@ footer a:hover { font-family: monospace; } +#change_zoom { + position: absolute; + right: 25px; + top: 105px; + z-index: 1001; +} + +#change_zoom > button { + border-radius: 40px; + width: 40px; + height: 40px; + outline: 0; +} + #add_shape { position: absolute; right: 25px; diff --git a/public/js/main.js b/public/js/main.js index 8d3d263..7ae3d10 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -1,7 +1,8 @@ window.dg = { - version: "v1.0.2", + version: "v1.1.0", config: { width: 1000, + autoScale: true, _fontSize: 0, _scale: 1, set fontSize(size) { @@ -68,10 +69,22 @@ function addInstall() { $(function() { addInstall(); - dg.config.scale = document.getElementById("main").clientWidth / dg.config.width; - $(window).on("resize", function() { - dg.config.scale = document.getElementById("main").clientWidth / dg.config.width; - }); + + function autoScale() { + if (dg.config.autoScale) { + dg.config.scale = document.getElementById("main").clientWidth / dg.config.width; + document.getElementById("shape-container").style.width = ""; + } else { + dg.config.width = document.getElementById("main").clientWidth / dg.config.scale; + document.getElementById("shape-container").style.width = dg.config.width + "px"; + } + // TODO cambiar de lugar + $("#shapeRange").val(Math.log2(dg.config.scale * 10)); + } + + $(window).on("resize", autoScale); + autoScale(); + document.getElementById("version").innerHTML = dg.version; dg.step.check(); }); diff --git a/public/js/menu.js b/public/js/menu.js index 1aabae0..a999a98 100644 --- a/public/js/menu.js +++ b/public/js/menu.js @@ -422,6 +422,52 @@ dg.menu = { } }, + generarAgregarZoom: function() { + + + var $todo = $(`
+ + +
`); + + $("#buttons").append($todo).find('#change_zoom .dropdown-menu').click(function(e) { + e.stopPropagation(); + }); + }, + generarCrear: function() { document.getElementById('intro').innerHTML = '

¡Nuevo!


Elija una opción debajo para comenzar'; }, @@ -551,5 +597,25 @@ dg.menu = { localStorage.setItem("functions", JSON.stringify(functions)); dg.step.check(); } + }, + + cambiarTamañoFuente: function(value) { + dg.config.fontSize = value; + }, + + cambiarZoom: function(value) { + $("#automaticShapeZoom").val(false); + dg.config.scale = 0.1 * Math.pow(2, value); + }, + + cambiarZoomAutomatico: function(value) { + dg.config.autoScale = value; + if (value) { + dg.config.width = 1000; + } + $(window).trigger("resize"); + $("#shapeRange").prop("disabled", value); + $("#shapeRange").val(Math.log2(dg.config.scale * 10)); } + } diff --git a/public/js/step.js b/public/js/step.js index 639420e..a9e1881 100644 --- a/public/js/step.js +++ b/public/js/step.js @@ -86,6 +86,7 @@ dg.step = { dg.shape.generateSVG(); dg.menu.generarAgregarShape(); dg.menu.generarAgregarShapeTrash(); + dg.menu.generarAgregarZoom(); window.addEventListener('beforeunload', dg.menu.saveDiagram); init_interact(); }, diff --git a/public/sw.js b/public/sw.js index 56ecadd..b49b554 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const cacheName = 'Cache v1.0.2'; +const cacheName = 'Cache v1.1.0'; const resourcesToPrecache = [ '/', 'index.html',