diff --git a/builddate.js b/builddate.js index cd8e91d..0d766d9 100644 --- a/builddate.js +++ b/builddate.js @@ -1 +1 @@ -var CONF_builddate="20241201-113430" +var CONF_builddate="20241230-131437" diff --git a/css/styles.css b/css/styles.css index a9caab0..e64f2cd 100644 --- a/css/styles.css +++ b/css/styles.css @@ -23,6 +23,34 @@ body { cursor: default; } +/* SPINNER STUFF */ + +.spinner { + display: none; + width: 50px; + height: 50px; + border: 5px solid rgba(0, 0, 0, 0.1); + border-top: 5px solid #000; + border-radius: 50%; + animation: spin 1s linear infinite; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +.loading .spinner { + display: block; +} + + + + button, select, select option, input[type="checkbox"] { cursor: pointer; } @@ -95,6 +123,47 @@ ul#minitabs a:hover { left: 0px; right: 0px; bottom: 0; + justify-content: space-between; + /*padding: 0px 12px 0px 12px;*/ + display: flex; + background-color: #f8f8f8; + align-items: center; + width: 100%; + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE 10 and IE 11 */ + user-select: none; /* Standard syntax */ + border-bottom: 1px solid #c8c8c8; + flex-direction: row; +} + +#left-icons { + top: var(--menu-height); + height: var(--ribbon-height); + left: 0px; + right: 0px; + bottom: 0; + justify-content: left; + /*padding: 0px 12px 0px 12px;*/ + display: flex; + background-color: #f8f8f8; + align-items: center; + width: 100%; + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE 10 and IE 11 */ + user-select: none; /* Standard syntax */ + border-bottom: 1px solid #c8c8c8; + flex-direction: row; +} + +#right-icons { + top: var(--menu-height); + height: var(--ribbon-height); + left: 0px; + right: 0px; + bottom: 0; + justify-content: right; /*padding: 0px 12px 0px 12px;*/ display: flex; background-color: #f8f8f8; @@ -137,6 +206,46 @@ ul#minitabs a:hover { white-space: nowrap; /* Prevent text from wrapping */ } +.icon-button { + height: 50px; + margin: 0 0 0 5px; + text-align: center; + cursor: pointer; + font-size: 24px; +} + +.box { + position: absolute; + background-color: rgba(192, 192, 192, 0); + border: 0px solid #000; + cursor: pointer; + box-sizing: border-box; /* Include border in size calculation */ + transform: rotate(0deg); +} + +.boxlabel { + position: absolute; + font-size: 11px; + background-color: rgba(192, 192, 192, 0); + border: 0px solid #000; + cursor: pointer; + box-sizing: border-box; /* Include border in size calculation */ + transform: rotate(0deg); + display: inline-block; + white-space: nowrap; + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE 10 and IE 11 */ +} + +.boxlabel.hidden { display: none; } + +.box.selected { + border: calc(var(--selectPadding) * 1px) solid red; +} + +.box.hidden { display: none; } + /* APP */ #app { @@ -176,18 +285,17 @@ ul#minitabs a:hover { left: 0; right: 0; bottom: 0; - overflow: hidden; + overflow: auto; /* Add scrollbars if content overflows */ background-color: #ffffff; /* Optional: Background color for visibility */ - padding: 0x; /* Padding to create the empty border effect */ - display: flex; + padding: 0; /* Padding to create the empty border effect */ flex-direction: row; /* Ensure columns are side by side */ } #paper { top: 10px; left: 10px; - width: 297mm; /* A4 paper width in landscape mode */ - height: 210mm; /* A4 paper height */ + width: 277mm; /* Useful drawing area on A4 */ + height: 150mm; /* Useful drawing area on A4 */ background-color: white; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19); border-radius: 5px; @@ -285,3 +393,12 @@ table { color: #B22222; /* Firebrick red for text */ } +.svg-icon { + position: absolute; + /*width: 90px; + height: 90px;*/ + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + pointer-events: none; /* Allow clicks to pass through the SVG */ +} diff --git a/eendraadschema.js b/eendraadschema.js index 7c480fe..08d8181 100644 --- a/eendraadschema.js +++ b/eendraadschema.js @@ -96,6 +96,19 @@ function isInt(value) { parseInt(value) == value && !isNaN(parseInt(value, 10)); } +function getPixelsPerMillimeter() { + var div = document.createElement('div'); + div.style.width = '10mm'; + div.style.position = 'absolute'; + document.body.appendChild(div); + var widthInPixels = div.offsetWidth; + document.body.removeChild(div); + var pixelsPerMillimeter = widthInPixels / 10; + return pixelsPerMillimeter; +} +// Example usage +var pixelsPerMM = getPixelsPerMillimeter(); +console.log("Your browser uses approximately ".concat(pixelsPerMM, " pixels per millimeter.")); function svgTextWidth(input, fontsize, options) { if (fontsize === void 0) { fontsize = 10; } if (options === void 0) { options = ''; } @@ -182,9 +195,15 @@ function flattenSVG(SVGstruct, shiftx, shifty, node, overflowright) { outstruct.attributes.getNamedItem("x").nodeValue = parseFloat(outstruct.attributes.getNamedItem("x").nodeValue) + shiftx; outstruct.attributes.getNamedItem("y").nodeValue = parseFloat(outstruct.attributes.getNamedItem("y").nodeValue) + shifty; if (outstruct.attributes.getNamedItem("transform")) { - outstruct.attributes.getNamedItem("transform").value = "rotate(-90 " + - outstruct.attributes.getNamedItem("x").nodeValue + "," + - outstruct.attributes.getNamedItem("y").nodeValue + ")"; + if (outstruct.attributes.getNamedItem("transform").value.includes('rotate')) { + outstruct.attributes.getNamedItem("transform").value = "rotate(-90 " + + outstruct.attributes.getNamedItem("x").nodeValue + "," + + outstruct.attributes.getNamedItem("y").nodeValue + ")"; + } + else { + outstruct.attributes.getNamedItem("transform").value = "scale(-1,1) translate(-" + + outstruct.attributes.getNamedItem("x").nodeValue * 2 + ",0)"; + } } } if (SVGstruct.localName == "polygon") { @@ -240,6 +259,18 @@ function browser_ie_detected() { else return false; } +var randomId = (function () { + var counters = {}; + return function (prefix) { + if (prefix === void 0) { prefix = "Rnd_"; } + if (!(prefix in counters)) { + counters[prefix] = 0; + } + var value = counters[prefix]; + counters[prefix]++; + return "".concat(prefix).concat(value.toString()); + }; +})(); var Session = /** @class */ (function () { function Session() { this.sessionKey = 'SessionJS'; @@ -557,12 +588,14 @@ var Print_Table = /** @class */ (function () { var minsvgwidth = 3 / 4 * maxsvgwidth; var page = 0; var pos = 0; - while ((this.maxwidth - pos) > maxsvgwidth) { // The undivided part still does not fit on a page - pos = this.pagemarkers.findMinDepth(pos + minsvgwidth, pos + maxsvgwidth).xpos; - while (this.pages.length < page + 2) - this.addPage(); - this.setStop(page, pos); - page++; + if (maxsvgwidth > 0) { + while ((this.maxwidth - pos) > maxsvgwidth) { // The undivided part still does not fit on a page + pos = this.pagemarkers.findMinDepth(pos + minsvgwidth, pos + maxsvgwidth).xpos; + while (this.pages.length < page + 2) + this.addPage(); + this.setStop(page, pos); + page++; + } } // The last page stops at the maximum size of the SVG this.setStop(page, this.maxwidth); @@ -841,9 +874,10 @@ function printsvg() { structure.properties.dpi = 300; var svg = flattenSVGfromString(structure.toSVG(0, "horizontal").data); var pages = Array.from({ length: structure.print_table.pages.length }, function (_, i) { return i + 1; }); + var sitplanprint = structure.sitplan.toSitPlanPrint(); printPDF(svg, structure.print_table, structure.properties, pages, document.getElementById("dopdfname").value, //filename - document.getElementById("progress_pdf") //HTML element where callback status can be given - ); + document.getElementById("progress_pdf"), //HTML element where callback status can be given + sitplanprint); } function renderPrintSVG(outSVG) { document.getElementById("printarea").innerHTML = '
Vergeet niet regelmatig uw werkop te slaan in het "Bestand"-menu.
\n Welkom op \u00E9\u00E9ndraadschema\n
\n Kies \u00E9\u00E9n van onderstaande voorbeelden om van te starten of start van een leeg schema (optie 3).\n