arreglado grapado

This commit is contained in:
2024-10-25 13:42:09 +02:00
parent eb806621c6
commit adcf2fbec3
4 changed files with 85 additions and 74 deletions

View File

@ -728,6 +728,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
'servicios' => $reqData['servicios'] ?? [], 'servicios' => $reqData['servicios'] ?? [],
); );
$datos_presupuesto['id'] = $id;
$resultado_presupuesto = $this->calcular_presupuesto($datos_presupuesto, $selected_tirada, true); $resultado_presupuesto = $this->calcular_presupuesto($datos_presupuesto, $selected_tirada, true);
if (isset($resultado_presupuesto['errors'])) { if (isset($resultado_presupuesto['errors'])) {
@ -1402,7 +1404,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if ($interior == -1) { if ($interior == -1) {
$errorModel = new ErrorPresupuesto(); $errorModel = new ErrorPresupuesto();
$errorModel->insertError( $errorModel->insertError(
$datos_entrada['id'], $datos_entrada['id']==0?null:$datos_entrada['id'],
auth()->user()->id, auth()->user()->id,
' '
No se puede obtener el interior', No se puede obtener el interior',

View File

@ -125,7 +125,7 @@ class Direcciones {
validators: { validators: {
callback: { callback: {
callback: () => { callback: () => {
const div = $('#divErrorEnvios'); // Selecciona el div /* const div = $('#divErrorEnvios'); // Selecciona el div
div.find('.fv-plugins-message-container').remove(); div.find('.fv-plugins-message-container').remove();
@ -149,6 +149,8 @@ class Direcciones {
</div> </div>
`); `);
return false; return false;
*/
return true;
}, },
} }

View File

@ -439,7 +439,11 @@ class PresupuestoCliente {
} }
} }
else { else {
popSuccessAlert(response.message); if(response.error){
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
}
else
popSuccessAlert(response.message);
} }
}, },
() => { $('#loader').modal('hide'); } () => { $('#loader').modal('hide'); }

View File

@ -1,7 +1,7 @@
class previewFormas { class previewFormas {
constructor(container, tipoLibro, tipoTapa, size, datos) { constructor(container, tipoLibro, tipoTapa, size, datos) {
this.container = container; this.container = container;
this.tipoLibro = tipoLibro; this.tipoLibro = tipoLibro;
this.tipoTapa = tipoTapa; this.tipoTapa = tipoTapa;
@ -11,10 +11,14 @@ class previewFormas {
this.alto = datos.alto; this.alto = datos.alto;
this.lomo = datos.lomo; this.lomo = datos.lomo;
if(datos.solapas == undefined || datos.solapas == null || datos.solapas == false) if (datos.solapas == undefined || datos.solapas == null || datos.solapas == false) {
this.solapa = 0; this.solapa = 0;
else this.offsetSolapa = 0.0;
}
else {
this.solapa = datos.solapas; this.solapa = datos.solapas;
this.offsetSolapa = 3.0;
}
this.lomoRedondo = datos.lomoRedondo; this.lomoRedondo = datos.lomoRedondo;
} }
@ -49,7 +53,7 @@ class previewFormas {
let sangradoTexto = "Sangrado 5 mm"; let sangradoTexto = "Sangrado 5 mm";
let sangradoValor = parseFloat(5); // mm let sangradoValor = parseFloat(5); // mm
let offsetSolapaValor = parseFloat(0); // mm let offsetSolapaValor = parseFloat(0); // mm
// Definicion de los parametros del Esquema de Cubierta (EC) // Definicion de los parametros del Esquema de Cubierta (EC)
if (this.solapa == 0) { if (this.solapa == 0) {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
@ -59,13 +63,13 @@ class previewFormas {
anchoSangrado = 800; // px anchoSangrado = 800; // px
altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px
} }
altoLibro = altoSangrado * 0.97; altoLibro = altoSangrado * 0.97;
anchoLibro = anchoSangrado * 0.419; anchoLibro = anchoSangrado * 0.419;
anchoSolapa = 0; anchoSolapa = 0;
lomoLibro = anchoSangrado * 0.133; lomoLibro = anchoSangrado * 0.133;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} else { } else {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
anchoSangrado = 350; // px anchoSangrado = 350; // px
@ -80,14 +84,14 @@ class previewFormas {
lomoLibro = anchoSangrado * 0.09; lomoLibro = anchoSangrado * 0.09;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} }
// Clear the canvas element // Clear the canvas element
this.container.empty(); this.container.empty();
// Get the element for placing the graphical elements // Get the element for placing the graphical elements
var previewEC = new Two({ fitted: true }).appendTo(this.container[0]); var previewEC = new Two({ fitted: true }).appendTo(this.container[0]);
// Calculate the center of the canvas element // Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle( var sangrado = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -98,7 +102,7 @@ class previewFormas {
sangrado.dashes = [5, 5]; sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1'; sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1; sangrado.linewidth = 1;
if (this.solapa != 0) { if (this.solapa != 0) {
var solapas = previewEC.makeRectangle( var solapas = previewEC.makeRectangle(
origenEC.x, origenEC.x,
@ -107,7 +111,7 @@ class previewFormas {
altoLibro); altoLibro);
solapas.stroke = 'black'; solapas.stroke = 'black';
solapas.linewidth = 1; solapas.linewidth = 1;
// Cotas Solapas // Cotas Solapas
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
var cotaSolapa2 = previewEC.makeDobleArrow( var cotaSolapa2 = previewEC.makeDobleArrow(
@ -124,7 +128,7 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaSolapa1.linewidth = 2; cotaSolapa1.linewidth = 2;
// Textos Solapas // Textos Solapas
let stylesSolapa = { size: 18, family: 'Public Sans' }; let stylesSolapa = { size: 18, family: 'Public Sans' };
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
@ -133,9 +137,9 @@ class previewFormas {
previewEC.makeText(anchoSolapa.toFixed(1) + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(anchoSolapa.toFixed(1) + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(anchoSolapa.toFixed(1) + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(anchoSolapa.toFixed(1) + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
} }
} }
var libro = previewEC.makeRectangle( var libro = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -143,7 +147,7 @@ class previewFormas {
altoLibro); altoLibro);
libro.stroke = 'black'; libro.stroke = 'black';
libro.linewidth = 1; libro.linewidth = 1;
var lomo = previewEC.makeRectangle( var lomo = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -152,7 +156,7 @@ class previewFormas {
lomo.stroke = 'black'; lomo.stroke = 'black';
lomo.fill = '#F4F8F2'; lomo.fill = '#F4F8F2';
lomo.linewidth = 1; lomo.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas: // Cotas:
@ -198,8 +202,8 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaPortada.linewidth = 2; cotaPortada.linewidth = 2;
// Textos: // Textos:
// Titulos generales // Titulos generales
let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' }; let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' };
@ -222,11 +226,11 @@ class previewFormas {
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
} }
previewEC.update(); previewEC.update();
} }
@ -237,14 +241,14 @@ class previewFormas {
let styleCotas = { size: 12, family: 'Public Sans' }; let styleCotas = { size: 12, family: 'Public Sans' };
let sangradoTexto = "Sangrado 20 mm"; let sangradoTexto = "Sangrado 20 mm";
let sangradoValor = parseFloat(20); // mm let sangradoValor = parseFloat(20); // mm
if(this.ancho >= 210 || this.alto >= 297){ if (this.ancho >= 210 || this.alto >= 297) {
sangradoValor = parseFloat(15); // mm sangradoValor = parseFloat(15); // mm
sangradoTexto = "Sangrado 15 mm"; sangradoTexto = "Sangrado 15 mm";
} }
let anchoPliegue = parseFloat(7); // mm cajo let anchoPliegue = parseFloat(7); // mm cajo
let altoPliegue = parseFloat(7); // mm let altoPliegue = parseFloat(7); // mm
let anchoCarton = parseFloat(6); // mm let anchoCarton = parseFloat(6); // mm
if(this.lomoRedondo) if (this.lomoRedondo)
anchoCarton += parseFloat(6); // mm anchoCarton += parseFloat(6); // mm
// Definicion de los parametros del Esquema de Cubierta (EC) // Definicion de los parametros del Esquema de Cubierta (EC)
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
@ -258,15 +262,15 @@ class previewFormas {
anchoLibro = anchoSangrado * 0.39; anchoLibro = anchoSangrado * 0.39;
lomoLibro = anchoSangrado * 0.133; lomoLibro = anchoSangrado * 0.133;
anchoCubierta = (2 * anchoLibro) + lomoLibro; anchoCubierta = (2 * anchoLibro) + lomoLibro;
// Clear the canvas element // Clear the canvas element
this.container.empty(); this.container.empty();
// Get the element for placing the graphical elements // Get the element for placing the graphical elements
var previewEC = new Two({ fitted: true }).appendTo($(this.container)[0]); var previewEC = new Two({ fitted: true }).appendTo($(this.container)[0]);
// Calculate the center of the canvas element // Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle( var sangrado = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -277,7 +281,7 @@ class previewFormas {
sangrado.dashes = [5, 5]; sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1'; sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1; sangrado.linewidth = 1;
var libro = previewEC.makeRectangle( var libro = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -285,7 +289,7 @@ class previewFormas {
altoLibro); altoLibro);
libro.stroke = 'black'; libro.stroke = 'black';
libro.linewidth = 1; libro.linewidth = 1;
var lomo = previewEC.makeRectangle( var lomo = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -294,7 +298,7 @@ class previewFormas {
lomo.stroke = 'black'; lomo.stroke = 'black';
lomo.fill = '#F4F8F2'; lomo.fill = '#F4F8F2';
lomo.linewidth = 1; lomo.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas: // Cotas:
@ -340,8 +344,8 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaPortada.linewidth = 2; cotaPortada.linewidth = 2;
// Textos: // Textos:
// Titulos generales // Titulos generales
let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' }; let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' };
@ -358,16 +362,16 @@ class previewFormas {
previewEC.makeText((this.lomo + anchoCarton).toFixed(1) + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.lomo + anchoCarton).toFixed(1) + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText((this.ancho + anchoPliegue).toFixed(1) + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.ancho + anchoPliegue).toFixed(1) + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText((this.ancho + anchoPliegue).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.ancho + anchoPliegue).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText((this.alto + altoPliegue).toFixed(1)+ " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText((this.alto + altoPliegue).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((this.alto + (2 * sangradoValor) + altoPliegue).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 55, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText((this.alto + (2 * sangradoValor) + altoPliegue).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 55, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * this.ancho) + this.lomo + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm", previewEC.makeText((2 * this.ancho) + this.lomo + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm",
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
} }
previewEC.update(); previewEC.update();
} }
#portadaEspiral(isTapaDura = false) { #portadaEspiral(isTapaDura = false) {
@ -377,8 +381,8 @@ class previewFormas {
let styleCotas = { size: 12, family: 'Public Sans' }; let styleCotas = { size: 12, family: 'Public Sans' };
let sangradoTexto = (isTapaDura) ? "Sangrado 20 mm" : "Sangrado 5 mm"; let sangradoTexto = (isTapaDura) ? "Sangrado 20 mm" : "Sangrado 5 mm";
let sangradoValor = (isTapaDura) ? parseFloat(20) : parseFloat(5); // mm let sangradoValor = (isTapaDura) ? parseFloat(20) : parseFloat(5); // mm
// Definicion de los parametros del Esquema de Cubierta (EC) // Definicion de los parametros del Esquema de Cubierta (EC)
if ((this.solapa !== 0) && (!isTapaDura)) { if ((this.solapa !== 0) && (!isTapaDura)) {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
@ -396,7 +400,7 @@ class previewFormas {
anchoCubierta = 2 * (anchoLibro + anchoSolapa + sangrado) + anchoCalle; anchoCubierta = 2 * (anchoLibro + anchoSolapa + sangrado) + anchoCalle;
offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa / 2 + sangrado; offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa / 2 + sangrado;
} else { } else {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
anchoSangrado = 350; // px anchoSangrado = 350; // px
altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px
} else { } else {
@ -410,11 +414,11 @@ class previewFormas {
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + anchoCalle; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + anchoCalle;
offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa + sangradoValor; offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa + sangradoValor;
} }
var previewEC = new Two({ fitted: true }).appendTo(this.container[0]); var previewEC = new Two({ fitted: true }).appendTo(this.container[0]);
// Calculate the center of the canvas element // Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle( var sangrado = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -425,7 +429,7 @@ class previewFormas {
sangrado.dashes = [5, 5]; sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1'; sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1; sangrado.linewidth = 1;
if ((this.solapa != 0) && (!isTapaDura)) { if ((this.solapa != 0) && (!isTapaDura)) {
var solapa1 = previewEC.makeRectangle( var solapa1 = previewEC.makeRectangle(
origenEC.x + (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor), origenEC.x + (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor),
@ -434,7 +438,7 @@ class previewFormas {
altoLibro); altoLibro);
solapa1.stroke = 'black'; solapa1.stroke = 'black';
solapa1.linewidth = 1; solapa1.linewidth = 1;
var solapa2 = previewEC.makeRectangle( var solapa2 = previewEC.makeRectangle(
origenEC.x - (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor), origenEC.x - (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor),
origenEC.y, origenEC.y,
@ -442,7 +446,7 @@ class previewFormas {
altoLibro); altoLibro);
solapa2.stroke = 'black'; solapa2.stroke = 'black';
solapa2.linewidth = 1; solapa2.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas // Cotas
@ -460,7 +464,7 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaSolapa1.linewidth = 2; cotaSolapa1.linewidth = 2;
// Textos Solapas // Textos Solapas
let stylesSolapa = { size: 18, family: 'Public Sans' }; let stylesSolapa = { size: 18, family: 'Public Sans' };
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa);
@ -469,9 +473,9 @@ class previewFormas {
previewEC.makeText((this.solapa).toFixed(1) + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.solapa).toFixed(1) + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(this.solapa.toFixed(1) + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(this.solapa.toFixed(1) + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
} }
} }
var portada = previewEC.makeRectangle( var portada = previewEC.makeRectangle(
origenEC.x + (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), origenEC.x + (anchoLibro / 2 + anchoCalle / 2 + sangradoValor),
origenEC.y, origenEC.y,
@ -479,7 +483,7 @@ class previewFormas {
altoLibro); altoLibro);
portada.stroke = 'black'; portada.stroke = 'black';
portada.linewidth = 1; portada.linewidth = 1;
var contraportada = previewEC.makeRectangle( var contraportada = previewEC.makeRectangle(
origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor),
origenEC.y, origenEC.y,
@ -487,7 +491,7 @@ class previewFormas {
altoLibro); altoLibro);
contraportada.stroke = 'black'; contraportada.stroke = 'black';
contraportada.linewidth = 1; contraportada.linewidth = 1;
var calle = previewEC.makeRectangle( var calle = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -497,7 +501,7 @@ class previewFormas {
calle.dashes = [2, 5]; calle.dashes = [2, 5];
calle.fill = '#F4F8F2'; calle.fill = '#F4F8F2';
calle.linewidth = 1; calle.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas: // Cotas:
@ -536,8 +540,8 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaPortada.linewidth = 2; cotaPortada.linewidth = 2;
// Textos: // Textos:
// Titulos generales // Titulos generales
let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' }; let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' };
@ -573,9 +577,9 @@ class previewFormas {
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
} }
previewEC.update(); previewEC.update();
} }
@ -586,8 +590,7 @@ class previewFormas {
let styleCotas = { size: 12, family: 'Public Sans' }; let styleCotas = { size: 12, family: 'Public Sans' };
let sangradoTexto = "Sangrado 5 mm"; let sangradoTexto = "Sangrado 5 mm";
let sangradoValor = parseFloat(5); // mm let sangradoValor = parseFloat(5); // mm
let offsetSolapaValor = parseFloat(0); // mm
// Definicion de los parametros del Esquema de Cubierta (EC) // Definicion de los parametros del Esquema de Cubierta (EC)
if (this.solapa == 0) { if (this.solapa == 0) {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
@ -602,7 +605,7 @@ class previewFormas {
anchoSolapa = 0; anchoSolapa = 0;
lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} else { } else {
if (this.size == "thumbnail") { if (this.size == "thumbnail") {
anchoSangrado = 350; // px anchoSangrado = 350; // px
@ -617,11 +620,11 @@ class previewFormas {
lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} }
var previewEC = new Two({ fitted: true }).appendTo(this.container[0]); var previewEC = new Two({ fitted: true }).appendTo(this.container[0]);
// Calculate the center of the canvas element // Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle( var sangrado = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -632,7 +635,7 @@ class previewFormas {
sangrado.dashes = [5, 5]; sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1'; sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1; sangrado.linewidth = 1;
if (this.solapa != 0) { if (this.solapa != 0) {
var solapas = previewEC.makeRectangle( var solapas = previewEC.makeRectangle(
origenEC.x, origenEC.x,
@ -641,7 +644,7 @@ class previewFormas {
altoLibro); altoLibro);
solapas.stroke = 'black'; solapas.stroke = 'black';
solapas.linewidth = 1; solapas.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas // Cotas
@ -659,7 +662,7 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaSolapa1.linewidth = 2; cotaSolapa1.linewidth = 2;
// Textos Solapas // Textos Solapas
let stylesSolapa = { size: 18, family: 'Public Sans' }; let stylesSolapa = { size: 18, family: 'Public Sans' };
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
@ -668,9 +671,9 @@ class previewFormas {
previewEC.makeText(this.solapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(this.solapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(this.solapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(this.solapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
} }
} }
var libro = previewEC.makeRectangle( var libro = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -678,7 +681,7 @@ class previewFormas {
altoLibro); altoLibro);
libro.stroke = 'black'; libro.stroke = 'black';
libro.linewidth = 1; libro.linewidth = 1;
var lomo = previewEC.makeRectangle( var lomo = previewEC.makeRectangle(
origenEC.x, origenEC.x,
origenEC.y, origenEC.y,
@ -687,7 +690,7 @@ class previewFormas {
lomo.stroke = 'black'; lomo.stroke = 'black';
lomo.fill = '#F4F8F2'; lomo.fill = '#F4F8F2';
lomo.linewidth = 1; lomo.linewidth = 1;
// Cotas y textos // Cotas y textos
if (this.size != "thumbnail") { if (this.size != "thumbnail") {
// Cotas: // Cotas:
@ -726,7 +729,7 @@ class previewFormas {
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); 10);
cotaPortada.linewidth = 2; cotaPortada.linewidth = 2;
// Textos: // Textos:
// Titulos generales // Titulos generales
let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' }; let stylesEC = { size: 22, weight: 'bold', family: 'Public Sans' };
@ -739,16 +742,16 @@ class previewFormas {
previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
// Cotas // Cotas
previewEC.makeText((anchoLibro + offsetSolapaValor).toFixed(1) + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.ancho + this.offsetSolapa).toFixed(1) + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText((anchoLibro + offsetSolapaValor).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText((this.ancho + this.offsetSolapa).toFixed(1) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(altoLibro.toFixed(1) + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(this.alto.toFixed(1) + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(altoLibro.toFixed(1) + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(this.alto.toFixed(1) + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(((2 * anchoLibro) + (2 * (anchoSolapa + offsetSolapaValor)) + lomoLibro + (2 * sangradoValor)).toFixed(1) + " mm", previewEC.makeText(((2 * anchoLibro) + (2 * (this.solapa + this.offsetSolapa)) + this.lomo + (2 * sangradoValor)).toFixed(1) + " mm",
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
} }
previewEC.update(); previewEC.update();
} }
} }