Actualizacion automatica: 2024-05-21 15:49:10

This commit is contained in:
imnavajas
2024-05-21 15:49:11 +02:00
parent 3cb756a42f
commit 2364edb684
2 changed files with 424 additions and 389 deletions

View File

@ -42,8 +42,7 @@
<h4 id="resumenTotalIVA" class="mb-1">Total: 100</h4> <h4 id="resumenTotalIVA" class="mb-1">Total: 100</h4>
<h6 id="resumenPrecioU" class="mb-0">10.4/ud</h6> <h6 id="resumenPrecioU" class="mb-0">10.4/ud</h6>
<div id="shape-container"> <div id="shape-container">
<div title="Pulsar para ver esquema de cubierta" id="thumbnail_ec_shape" <div id="thumbnail_ec_shape" style="width:350px;height:300px;margin:2.5% auto;"></div>
style="width:350px;height:300px;margin:2.5% auto;"></div>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<button type="button" id="pv_details" class="btn btn-primary align-content-center" <button type="button" id="pv_details" class="btn btn-primary align-content-center"
data-bs-toggle="modal" data-bs-target="#pv_ec_modal"> data-bs-toggle="modal" data-bs-target="#pv_ec_modal">
@ -57,15 +56,15 @@
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="pv_ec_modal" tabindex="-1"> <div class="modal fade" id="pv_ec_modal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
<div class="modal-content" style="width:850px;height:700px;margin:2.5% auto;"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Esquema de cubierta</h5> <h5 class="modal-title">Esquema de cubierta</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button> </button>
</div> </div>
<div class="modal-body" > <div class="modal-body" >
<div id="pv_ec_shape" style="width:700px;height:500px;margin:2.5% auto;"></div> <div id="pv_ec_shape" style="width:850px;height:600px;margin:2.5% auto;"></div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>

View File

@ -3,19 +3,15 @@ var pvObj;
$('#toReview').on("click", function () { $('#toReview').on("click", function () {
console.log('ec draw'); portadaEspiral(true, false);
portadaTapaDura(true);
//previewEsquemaCubierta('ec', '',''); //previewEsquemaCubierta('ec', '','');
}); });
$(document).on('shown.bs.modal', function (e) { $(document).on('shown.bs.modal', function (e) {
// do cool stuff here all day… no need to change bootstrap
console.log('eooo');
portadaTapaDura(false); portadaEspiral(false, false);
}) })
@ -73,7 +69,7 @@ function portadaTapaDura(isThumbnail = false) {
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 {
anchoSangrado = 700; // 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.88; altoLibro = altoSangrado * 0.88;
@ -86,8 +82,6 @@ function portadaTapaDura(isThumbnail = false) {
// Get the element for placing the graphical elements // Get the element for placing the graphical elements
var divEC = document.getElementById(divIdName); var divEC = document.getElementById(divIdName);
var previewEC = new Two({fitted: true}).appendTo(divEC); var previewEC = new Two({fitted: true}).appendTo(divEC);
//previewEC.width = 700;
//previewEC.height = 650;
// 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);
@ -120,6 +114,202 @@ function portadaTapaDura(isThumbnail = false) {
lomo.fill = '#F4F8F2'; lomo.fill = '#F4F8F2';
lomo.linewidth = 1; lomo.linewidth = 1;
// Cotas y textos
if (!isThumbnail) {
// Cotas:
var cotaAnchoCubierta = previewEC.makeDobleArrow(
origenEC.x - (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
origenEC.x + (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
10);
cotaAnchoCubierta.linewidth = 2;
var cotaAltoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoCubierta / 2) + 40,
origenEC.y + (altoSangrado / 2),
origenEC.x + (anchoCubierta / 2) + 40,
origenEC.y - (altoSangrado / 2),
10);
cotaAltoCubierta.linewidth = 2;
var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2) + 35,
origenEC.y + (altoLibro / 2),
origenEC.x + (lomoLibro / 2) + 35,
origenEC.y - (altoLibro / 2),
10);
cotaAltoLibro.linewidth = 2;
var cotaLomo = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
origenEC.x + (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
10);
cotaLomo.linewidth = 2;
var cotaContraportada = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
origenEC.x - (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
10);
cotaContraportada.linewidth = 2;
var cotaPortada = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
origenEC.x + (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
10);
cotaPortada.linewidth = 2;
// Textos:
// Titulos generales
let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'};
previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2;
// Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
// Cotas
previewEC.makeText(pvObj.lomoLibro + anchoCarton + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + altoPliegue + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + altoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 55 , origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm",
origenEC.x,
origenEC.y + (altoLibro / 2) + 50,
styleCotas);
}
previewEC.update();
}
function portadaTapaBlanda(isThumbnail = false) {
// Variables locales
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
let styleCotas = {size: 12, family: 'Public Sans'};
let sangradoTexto = "Sangrado 5 mm";
let sangradoValor = parseFloat(5); // mm
let offsetSolapaValor = parseFloat(0); // mm
let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape';
// Get the preview Object parameters
getObjetoToPreview();
// Definicion de los parametros del Esquema de Cubierta (EC)
if (pvObj.anchoSolapa == 0) {
if (isThumbnail) {
anchoSangrado = 350; // px
altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px
} else {
anchoSangrado = 800; // px
altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px
}
altoLibro = altoSangrado * 0.97;
anchoLibro = anchoSangrado * 0.419;
anchoSolapa = 0;
lomoLibro = anchoSangrado * 0.133;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} else {
if (isThumbnail) {
anchoSangrado = 350; // px
altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px
} else {
anchoSangrado = 750; // px
altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px
}
altoLibro = altoSangrado * 0.95;
anchoLibro = anchoSangrado * 0.28;
anchoSolapa = anchoSangrado * 0.163;
lomoLibro = anchoSangrado * 0.09;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
}
// Clear the canvas element
$(`#${divIdName}`).empty();
// Get the element for placing the graphical elements
var divEC = document.getElementById(divIdName);
var previewEC = new Two({fitted: true}).appendTo(divEC);
// Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoSangrado,
altoSangrado
);
sangrado.stroke = 'black';
sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1;
if (pvObj.anchoSolapa != 0) {
var solapas = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoCubierta,
altoLibro);
solapas.stroke = 'black';
solapas.linewidth = 1;
// Cotas Solapas
if (!isThumbnail) {
var cotaSolapa2 = previewEC.makeDobleArrow(
origenEC.x - anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x - anchoLibro - lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa2.linewidth = 2;
var cotaSolapa1 = previewEC.makeDobleArrow(
origenEC.x + anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x + anchoLibro + lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa1.linewidth = 2;
// Textos Solapas
let stylesSolapa = {size: 18, family: 'Public Sans'};
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
// Textos Cotas Solapas
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
}
}
var libro = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
((2 * anchoLibro) + lomoLibro),
altoLibro);
libro.stroke = 'black';
libro.linewidth = 1;
var lomo = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
lomoLibro,
altoLibro);
lomo.stroke = 'black';
lomo.fill = '#F4F8F2';
lomo.linewidth = 1;
// Cotas y textos // Cotas y textos
if (!isThumbnail) { if (!isThumbnail) {
// Cotas: // Cotas:
@ -172,20 +362,20 @@ function portadaTapaDura(isThumbnail = false) {
let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'}; let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'};
previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2; let a = previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2;
// Sangrados // Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + 13), 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 + 13), 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(pvObj.lomoLibro + anchoCarton + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + altoPliegue + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + altoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm", previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm",
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
@ -196,182 +386,7 @@ function portadaTapaDura(isThumbnail = false) {
} }
function portadaTapaBlanda() { function portadaEspiral(isThumbnail = false, isTapaDura = false) {
// Variables locales
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
let styleCotas = {size: 12, family: 'Public Sans'};
let sangradoTexto = "Sangrado 5 mm";
let sangradoValor = parseFloat(5); // mm
let offsetSolapaValor = parseFloat(0); // mm
// Get the preview Object parameters
getObjetoToPreview();
// Definicion de los parametros del Esquema de Cubierta (EC)
if (pvObj.anchoSolapa == 0) {
anchoSangrado = 600; // px
altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px
altoLibro = altoSangrado * 0.97;
anchoLibro = anchoSangrado * 0.419;
anchoSolapa = 0;
lomoLibro = anchoSangrado * 0.133;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} else {
anchoSangrado = 600; // px
altoSangrado = (anchoSangrado * 0.418 > 350) ? anchoSangrado * 0.418 : 350; // px
altoLibro = altoSangrado * 0.95;
anchoLibro = anchoSangrado * 0.28;
anchoSolapa = anchoSangrado * 0.163;
lomoLibro = anchoSangrado * 0.09;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
}
// Clear the canvas element
$('#pv_ec_shape').empty();
// Get the element for placing the graphical elements
var divEC = document.getElementById('pv_ec_shape');
var previewEC = new Two({fitted: true}).appendTo(divEC);
// Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var sangrado = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoSangrado,
altoSangrado
);
sangrado.stroke = 'black';
sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1;
if (pvObj.anchoSolapa != 0) {
var solapas = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoCubierta,
altoLibro);
solapas.stroke = 'black';
solapas.linewidth = 1;
// Cotas Solapas
var cotaSolapa2 = previewEC.makeDobleArrow(
origenEC.x - anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x - anchoLibro - lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa2.linewidth = 2;
var cotaSolapa1 = previewEC.makeDobleArrow(
origenEC.x + anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x + anchoLibro + lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa1.linewidth = 2;
// Textos Solapas
let stylesSolapa = {size: 18, family: 'Public Sans'};
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
// Textos Cotas Solapas
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
}
var libro = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
((2 * anchoLibro) + lomoLibro),
altoLibro);
libro.stroke = 'black';
libro.linewidth = 1;
var lomo = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
lomoLibro,
altoLibro);
lomo.stroke = 'black';
lomo.fill = '#F4F8F2';
lomo.linewidth = 1;
// Cotas
var cotaAnchoCubierta = previewEC.makeDobleArrow(
origenEC.x - (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
origenEC.x + (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
10);
cotaAnchoCubierta.linewidth = 2;
var cotaAltoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoCubierta / 2) + 35,
origenEC.y + (altoSangrado / 2),
origenEC.x + (anchoCubierta / 2) + 35,
origenEC.y - (altoSangrado / 2),
10);
cotaAltoCubierta.linewidth = 2;
var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2) + 35,
origenEC.y + (altoLibro / 2),
origenEC.x + (lomoLibro / 2) + 35,
origenEC.y - (altoLibro / 2),
10);
cotaAltoLibro.linewidth = 2;
var cotaLomo = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
origenEC.x + (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
10);
cotaLomo.linewidth = 2;
var cotaContraportada = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
origenEC.x - (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
10);
cotaContraportada.linewidth = 2;
var cotaPortada = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
origenEC.x + (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
10);
cotaPortada.linewidth = 2;
// Textos:
// Titulos generales
let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'};
previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
let a = previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2;
// Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
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
previewEC.makeText(pvObj.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm",
origenEC.x,
origenEC.y + (altoLibro / 2) + 50,
styleCotas);
previewEC.update();
}
function portadaEspiral() {
// Variables locales // Variables locales
let altoLibro, anchoLibro, anchoCalle, anchoCubierta, altoSangrado, anchoSangrado, anchoSolapa, offsetCubierta; let altoLibro, anchoLibro, anchoCalle, anchoCubierta, altoSangrado, anchoSangrado, anchoSolapa, offsetCubierta;
@ -379,14 +394,21 @@ function portadaEspiral() {
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
let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape';
// Get the preview Object parameters // Get the preview Object parameters
getObjetoToPreview(); getObjetoToPreview();
// Definicion de los parametros del Esquema de Cubierta (EC) // Definicion de los parametros del Esquema de Cubierta (EC)
anchoSangrado = 600; // px if ((pvObj.anchoSolapa !== 0) && (!isTapaDura)) {
if (isThumbnail) {
if ((pvObj.anchoSolapa !== 0) && (isTapaDura === 0)) { anchoSangrado = 350; // px
altoSangrado = (anchoSangrado * 0.418 > 350) ? anchoSangrado * 0.418 : 350; // px altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px
} else {
anchoSangrado = 750; // px
altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px
}
//altoSangrado = (anchoSangrado * 0.418 > 350) ? anchoSangrado * 0.418 : 350; // px
altoLibro = altoSangrado * 0.95; altoLibro = altoSangrado * 0.95;
anchoLibro = anchoSangrado * 0.28; anchoLibro = anchoSangrado * 0.28;
anchoCalle = anchoSangrado * 0.02; anchoCalle = anchoSangrado * 0.02;
@ -395,7 +417,14 @@ function portadaEspiral() {
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 {
altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px if (isThumbnail) {
anchoSangrado = 350; // px
altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px
} else {
anchoSangrado = 750; // px
altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px
}
//altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px
altoLibro = (isTapaDura) ? altoSangrado * 0.88 : altoSangrado * 0.97; altoLibro = (isTapaDura) ? altoSangrado * 0.88 : altoSangrado * 0.97;
anchoLibro = (isTapaDura) ? anchoSangrado * 0.39 : anchoSangrado * 0.419; anchoLibro = (isTapaDura) ? anchoSangrado * 0.39 : anchoSangrado * 0.419;
anchoCalle = anchoSangrado * 0.02; anchoCalle = anchoSangrado * 0.02;
@ -405,9 +434,9 @@ function portadaEspiral() {
} }
// Clear the canvas element // Clear the canvas element
$('#pv_ec_shape').empty(); $(`#${divIdName}`).empty();
// Get the element for placing the graphical elements // Get the element for placing the graphical elements
var divEC = document.getElementById('pv_ec_shape'); var divEC = document.getElementById(divIdName);
var previewEC = new Two({fitted: true}).appendTo(divEC); var previewEC = new Two({fitted: true}).appendTo(divEC);
// 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);
@ -423,7 +452,7 @@ function portadaEspiral() {
sangrado.fill = '#FCEAF1'; sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1; sangrado.linewidth = 1;
if (pvObj.anchoSolapa != 0) { if ((pvObj.anchoSolapa != 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),
origenEC.y, origenEC.y,
@ -440,29 +469,32 @@ function portadaEspiral() {
solapa2.stroke = 'black'; solapa2.stroke = 'black';
solapa2.linewidth = 1; solapa2.linewidth = 1;
// Cotas Solapas // Cotas y textos
var cotaSolapa2 = previewEC.makeDobleArrow( if (!isThumbnail) {
origenEC.x - (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa), // Cotas
origenEC.y - (altoLibro / 3), var cotaSolapa2 = previewEC.makeDobleArrow(
origenEC.x - (anchoLibro + sangradoValor + anchoCalle / 2), origenEC.x - (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x - (anchoLibro + sangradoValor + anchoCalle / 2),
cotaSolapa2.linewidth = 2; origenEC.y - (altoLibro / 3),
var cotaSolapa1 = previewEC.makeDobleArrow( 10);
origenEC.x + (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa), cotaSolapa2.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaSolapa1 = previewEC.makeDobleArrow(
origenEC.x + (anchoLibro + sangradoValor + anchoCalle / 2), origenEC.x + (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x + (anchoLibro + sangradoValor + anchoCalle / 2),
cotaSolapa1.linewidth = 2; origenEC.y - (altoLibro / 3),
10);
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);
previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa);
// Textos Cotas Solapas // Textos Cotas Solapas
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
}
} }
@ -492,84 +524,87 @@ function portadaEspiral() {
calle.fill = '#F4F8F2'; calle.fill = '#F4F8F2';
calle.linewidth = 1; calle.linewidth = 1;
// Cotas // Cotas y textos
var cotaAnchoCubierta = previewEC.makeDobleArrow( if (!isThumbnail) {
origenEC.x - (anchoSangrado / 2), // Cotas:
origenEC.y + (altoLibro / 2) + 35, var cotaAnchoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoSangrado / 2), origenEC.x - (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35, origenEC.y + (altoLibro / 2) + 35,
10); origenEC.x + (anchoSangrado / 2),
cotaAnchoCubierta.linewidth = 2; origenEC.y + (altoLibro / 2) + 35,
var cotaAltoCubierta = previewEC.makeDobleArrow( 10);
origenEC.x + (anchoSangrado / 2) + 15, cotaAnchoCubierta.linewidth = 2;
origenEC.y + (altoSangrado / 2), var cotaAltoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoSangrado / 2) + 15, origenEC.x + (anchoSangrado / 2) + 15,
origenEC.y - (altoSangrado / 2), origenEC.y + (altoSangrado / 2),
10); origenEC.x + (anchoSangrado / 2) + 15,
cotaAltoCubierta.linewidth = 2; origenEC.y - (altoSangrado / 2),
var cotaAltoLibro = previewEC.makeDobleArrow( 10);
origenEC.x + (anchoCalle / 2) + 35, cotaAltoCubierta.linewidth = 2;
origenEC.y + (altoLibro / 2), var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (anchoCalle / 2) + 35, origenEC.x + (anchoCalle / 2) + 35,
origenEC.y - (altoLibro / 2), origenEC.y + (altoLibro / 2),
10); origenEC.x + (anchoCalle / 2) + 35,
cotaAltoLibro.linewidth = 2; origenEC.y - (altoLibro / 2),
var cotaContraportada = previewEC.makeDobleArrow( 10);
origenEC.x - (anchoCalle / 2 + anchoLibro + sangradoValor), cotaAltoLibro.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaContraportada = previewEC.makeDobleArrow(
origenEC.x - ((anchoCalle / 2) + sangradoValor), origenEC.x - (anchoCalle / 2 + anchoLibro + sangradoValor),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x - ((anchoCalle / 2) + sangradoValor),
cotaContraportada.linewidth = 2; origenEC.y - (altoLibro / 3),
var cotaPortada = previewEC.makeDobleArrow( 10);
origenEC.x + ((anchoCalle / 2) + sangradoValor), cotaContraportada.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaPortada = previewEC.makeDobleArrow(
origenEC.x + (anchoCalle / 2 + anchoLibro + sangradoValor), origenEC.x + ((anchoCalle / 2) + sangradoValor),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x + (anchoCalle / 2 + anchoLibro + sangradoValor),
cotaPortada.linewidth = 2; origenEC.y - (altoLibro / 3),
10);
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'};
previewEC.makeText("Portada", previewEC.makeText("Portada",
origenEC.x + anchoLibro / 2 + anchoCalle / 2 + sangradoValor + 15, origenEC.x + anchoLibro / 2 + anchoCalle / 2 + sangradoValor + 15,
origenEC.y, origenEC.y,
stylesEC stylesEC
); );
previewEC.makeText("Contraportada", previewEC.makeText("Contraportada",
origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor),
origenEC.y, origenEC.y,
stylesEC stylesEC
); );
// Sangrados // Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x + (anchoSangrado / 2) - 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; previewEC.makeText(sangradoTexto, origenEC.x + (anchoSangrado / 2) - 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2;
previewEC.makeText(sangradoTexto, origenEC.x - (anchoSangrado / 2) + 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; previewEC.makeText(sangradoTexto, origenEC.x - (anchoSangrado / 2) + 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2;
// Cotas // Cotas
previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (anchoCalle / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (anchoCalle / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm",
origenEC.x + (anchoSangrado / 2) + 30, origenEC.x + (anchoSangrado / 2) + 30,
origenEC.y, origenEC.y,
styleCotas styleCotas
).rotation = -Math.PI / 2; ).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + " mm",
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
}
previewEC.update(); previewEC.update();
} }
function portadaGrapado() { function portadaGrapado(isThumbnail = false, isTapaDura = false) {
// Variables locales // Variables locales
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado; let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
@ -578,6 +613,8 @@ function portadaGrapado() {
let sangradoValor = parseFloat(5); // mm let sangradoValor = parseFloat(5); // mm
let offsetSolapaValor = parseFloat(0); // mm let offsetSolapaValor = parseFloat(0); // mm
let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape';
// Get the preview Object parameters // Get the preview Object parameters
getObjetoToPreview(); getObjetoToPreview();
@ -602,9 +639,9 @@ function portadaGrapado() {
} }
// Clear the canvas element // Clear the canvas element
$('#pv_ec_shape').empty(); $(`#${divIdName}`).empty();
// Get the element for placing the graphical elements // Get the element for placing the graphical elements
var divEC = document.getElementById('pv_ec_shape'); var divEC = document.getElementById(divIdName);
var previewEC = new Two({fitted: true}).appendTo(divEC); var previewEC = new Two({fitted: true}).appendTo(divEC);
// 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);
@ -629,29 +666,32 @@ function portadaGrapado() {
solapas.stroke = 'black'; solapas.stroke = 'black';
solapas.linewidth = 1; solapas.linewidth = 1;
// Cotas Solapas // Cotas y textos
var cotaSolapa2 = previewEC.makeDobleArrow( if (!isThumbnail) {
origenEC.x - anchoCubierta / 2, // Cotas
origenEC.y - (altoLibro / 3), var cotaSolapa2 = previewEC.makeDobleArrow(
origenEC.x - anchoLibro - lomoLibro / 2, origenEC.x - anchoCubierta / 2,
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x - anchoLibro - lomoLibro / 2,
cotaSolapa2.linewidth = 2; origenEC.y - (altoLibro / 3),
var cotaSolapa1 = previewEC.makeDobleArrow( 10);
origenEC.x + anchoCubierta / 2, cotaSolapa2.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaSolapa1 = previewEC.makeDobleArrow(
origenEC.x + anchoLibro + lomoLibro / 2, origenEC.x + anchoCubierta / 2,
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x + anchoLibro + lomoLibro / 2,
cotaSolapa1.linewidth = 2; origenEC.y - (altoLibro / 3),
10);
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);
previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
// Textos Cotas Solapas // Textos Cotas Solapas
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
}
} }
@ -672,76 +712,72 @@ function portadaGrapado() {
lomo.fill = '#F4F8F2'; lomo.fill = '#F4F8F2';
lomo.linewidth = 1; lomo.linewidth = 1;
// Cotas // Cotas y textos
var cotaAnchoCubierta = previewEC.makeDobleArrow( if (!isThumbnail) {
origenEC.x - (anchoSangrado / 2), // Cotas:
origenEC.y + (altoLibro / 2) + 35, var cotaAnchoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoSangrado / 2), origenEC.x - (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35, origenEC.y + (altoLibro / 2) + 35,
10); origenEC.x + (anchoSangrado / 2),
cotaAnchoCubierta.linewidth = 2; origenEC.y + (altoLibro / 2) + 35,
var cotaAltoCubierta = previewEC.makeDobleArrow( 10);
origenEC.x + (anchoCubierta / 2) + 35, cotaAnchoCubierta.linewidth = 2;
origenEC.y + (altoSangrado / 2), var cotaAltoCubierta = previewEC.makeDobleArrow(
origenEC.x + (anchoCubierta / 2) + 35, origenEC.x + (anchoCubierta / 2) + 35,
origenEC.y - (altoSangrado / 2), origenEC.y + (altoSangrado / 2),
10); origenEC.x + (anchoCubierta / 2) + 35,
cotaAltoCubierta.linewidth = 2; origenEC.y - (altoSangrado / 2),
var cotaAltoLibro = previewEC.makeDobleArrow( 10);
origenEC.x + (lomoLibro / 2) + 35, cotaAltoCubierta.linewidth = 2;
origenEC.y + (altoLibro / 2), var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2) + 35, origenEC.x + (lomoLibro / 2) + 35,
origenEC.y - (altoLibro / 2), origenEC.y + (altoLibro / 2),
10); origenEC.x + (lomoLibro / 2) + 35,
cotaAltoLibro.linewidth = 2; origenEC.y - (altoLibro / 2),
var cotaContraportada = previewEC.makeDobleArrow( 10);
origenEC.x - (lomoLibro / 2 + anchoLibro), cotaAltoLibro.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaContraportada = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2), origenEC.x - (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x - (lomoLibro / 2),
cotaContraportada.linewidth = 2; origenEC.y - (altoLibro / 3),
var cotaPortada = previewEC.makeDobleArrow( 10);
origenEC.x + (lomoLibro / 2), cotaContraportada.linewidth = 2;
origenEC.y - (altoLibro / 3), var cotaPortada = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2 + anchoLibro), origenEC.x + (lomoLibro / 2),
origenEC.y - (altoLibro / 3), origenEC.y - (altoLibro / 3),
10); origenEC.x + (lomoLibro / 2 + anchoLibro),
cotaPortada.linewidth = 2; origenEC.y - (altoLibro / 3),
10);
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'};
previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
// Sangrados // Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado); previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
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(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm",
origenEC.x, origenEC.x,
origenEC.y + (altoLibro / 2) + 50, origenEC.y + (altoLibro / 2) + 50,
styleCotas); styleCotas);
}
previewEC.update(); previewEC.update();
} }
function getLomoLibro() {
const anchoLomoInputs = $("#tableLineasPresupuesto tbody tr:visible td input[id*='_lomo']");
const anchoLomo = Array.from(anchoLomoInputs).reduce((sum, input) => sum + parseFloat($(input).val()), 0);
return parseFloat(anchoLomo.toFixed(2));
}
function getObjetoToPreview() { function getObjetoToPreview() {