mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadido preview cosido tapa blando con solapas
This commit is contained in:
@ -303,10 +303,12 @@
|
||||
var altoLib = 400;
|
||||
|
||||
var cubiertaObjeto = {
|
||||
altoLibro:altoLib,
|
||||
anchoLibro:altoLib * 0.67,
|
||||
solapas:0,
|
||||
lomo:altoLib * 0.21};
|
||||
altoLibro:220,
|
||||
anchoLibro:170,
|
||||
anchoCubierta:491,
|
||||
anchoSolapa:70,
|
||||
lomoLibro:11
|
||||
};
|
||||
|
||||
previewEsquemaCubierta(cubiertaObjeto);
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ function previewConfiguracionCubierta(cubiertaObj) {
|
||||
origenCubierta.y,
|
||||
fullBookWith,
|
||||
cubiertaObj.altoLibro);
|
||||
formaCubierta.stroke = '#6997D3';
|
||||
formaCubierta.fill = '#6997D3';
|
||||
formaCubierta.stroke = 'grey';
|
||||
formaCubierta.fill = '#F4F8F2';
|
||||
formaCubierta.linewidth = 1;
|
||||
|
||||
// Texts
|
||||
@ -59,32 +59,30 @@ function previewConfiguracionCubierta(cubiertaObj) {
|
||||
}
|
||||
|
||||
|
||||
function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
function previewEsquemaCubierta(objEC) {
|
||||
|
||||
// Variables locales
|
||||
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
|
||||
let stylesEC = {
|
||||
size: 24,
|
||||
weight: 'bold',
|
||||
family: 'Public Sans',
|
||||
}
|
||||
let styleCotas = {size: 12, family: 'Public Sans'};
|
||||
|
||||
// Definicion de los parametros del Esquema de Cubierta (EC)
|
||||
if (esquemaCubiertaObj.solapas == 0) {
|
||||
altoLibro = 400;
|
||||
anchoLibro = altoLibro * 0.67;
|
||||
lomoLibro = altoLibro * 0.21;
|
||||
anchoCubierta = (2 * anchoLibro) + lomoLibro;
|
||||
altoSangrado = altoLibro * 1.04;
|
||||
anchoSangrado = anchoCubierta * 1.03;
|
||||
}else{
|
||||
altoLibro = 400;
|
||||
anchoLibro = altoLibro * 0.67;
|
||||
anchoSolapa = altoLibro * 0.40;
|
||||
lomoLibro = altoLibro * 0.22;
|
||||
anchoCubierta = (2 * anchoLibro) + (2* anchoSolapa) + lomoLibro;
|
||||
altoSangrado = altoLibro * 1.04;
|
||||
anchoSangrado = anchoCubierta * 1.03;
|
||||
if (objEC.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
|
||||
@ -95,15 +93,6 @@ function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
// Calculate the center of the canvas element
|
||||
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
|
||||
|
||||
/*var solapas = previewEC.makeRectangle(
|
||||
origenEC.x,
|
||||
origenEC.y,
|
||||
((2 * esquemaCubiertaObj.anchoLibro) + (2 * (esquemaCubiertaObj.solapas + _offsetSolapas)) + esquemaCubiertaObj.lomo),
|
||||
esquemaCubiertaObj.altoLibro);
|
||||
solapas.stroke = '#5FD2B5';
|
||||
solapas.fill = '#5FD2B5';
|
||||
solapas.linewidth = 1;*/
|
||||
|
||||
var sangrado = previewEC.makeRectangle(
|
||||
origenEC.x,
|
||||
origenEC.y,
|
||||
@ -115,13 +104,47 @@ function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
sangrado.fill = '#FCEAF1';
|
||||
sangrado.linewidth = 1;
|
||||
|
||||
if (objEC.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(objEC.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(objEC.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.fill = '#6997D3';
|
||||
libro.linewidth = 1;
|
||||
|
||||
var lomo = previewEC.makeRectangle(
|
||||
@ -135,19 +158,19 @@ function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
|
||||
// Cotas
|
||||
var cotaAnchoCubierta = previewEC.makeDobleArrow(
|
||||
origenEC.x - (lomoLibro / 2 + anchoLibro),
|
||||
origenEC.x - (anchoCubierta / 2),
|
||||
origenEC.y + (altoLibro / 2) + 35,
|
||||
origenEC.x + (lomoLibro / 2 + anchoLibro),
|
||||
origenEC.x + (anchoCubierta / 2),
|
||||
origenEC.y + (altoLibro / 2) + 35,
|
||||
10);
|
||||
cotaAnchoCubierta.linewidth = 2;
|
||||
var cotaAltoCubierta = previewEC.makeDobleArrow(
|
||||
origenEC.x + (lomoLibro / 2 + anchoLibro) + 35,
|
||||
var cotaAltoLibro = previewEC.makeDobleArrow(
|
||||
origenEC.x + (anchoCubierta / 2) + 35,
|
||||
origenEC.y + (altoLibro / 2),
|
||||
origenEC.x + (lomoLibro / 2 + anchoLibro) + 35,
|
||||
origenEC.x + (anchoCubierta / 2) + 35,
|
||||
origenEC.y - (altoLibro / 2),
|
||||
10);
|
||||
cotaAltoCubierta.linewidth = 2;
|
||||
cotaAltoLibro.linewidth = 2;
|
||||
var cotaLomo = previewEC.makeDobleArrow(
|
||||
origenEC.x - (lomoLibro / 2),
|
||||
origenEC.y + (altoLibro / 3),
|
||||
@ -173,6 +196,7 @@ function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
|
||||
// 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;
|
||||
@ -180,22 +204,21 @@ function previewEsquemaCubierta(esquemaCubiertaObj) {
|
||||
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x + (lomoLibro / 2 + anchoLibro + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x - (lomoLibro / 2 + anchoLibro + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
|
||||
previewEC.makeText("Sangrado 3 mm", origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
|
||||
// Cotas
|
||||
let styleCotas = {size: 12, family: 'Public Sans'};
|
||||
previewEC.makeText(lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(anchoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(altoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
|
||||
previewEC.makeText(anchoCubierta + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas);
|
||||
previewEC.makeText(objEC.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(objEC.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(objEC.anchoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
|
||||
previewEC.makeText(objEC.altoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
|
||||
previewEC.makeText(objEC.anchoCubierta + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas);
|
||||
|
||||
previewEC.update();
|
||||
|
||||
// Update preview info fields
|
||||
$('#prevLibro').text(esquemaCubiertaObj.anchoLibro + "X" + esquemaCubiertaObj.altoLibro);
|
||||
$('#prevLomo').text(esquemaCubiertaObj.lomo);
|
||||
$('#prevSolapas').text(esquemaCubiertaObj.solapas);
|
||||
$('#prevLibro').text(objEC.anchoLibro + "X" + objEC.altoLibro);
|
||||
$('#prevLomo').text(objEC.lomoLibro);
|
||||
$('#prevSolapas').text(objEC.solapas);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user