Commit ba860f06fe7435fb9892f45896ecbb8029c0842f
Merge branch 'ww' into 'main'
perf: adjust page layout size unit to px See merge request huang/thingskit-drawio!55
Showing
2 changed files
with
37 additions
and
14 deletions
| ... | ... | @@ -698,8 +698,11 @@ Editor.prototype.getGraphXml = function(ignoreSelection) |
| 698 | 698 | |
| 699 | 699 | if (this.graph.view.translate.x != 0 || this.graph.view.translate.y != 0) |
| 700 | 700 | { |
| 701 | - node.setAttribute('dx', Math.round(this.graph.view.translate.x * 100) / 100); | |
| 702 | - node.setAttribute('dy', Math.round(this.graph.view.translate.y * 100) / 100); | |
| 701 | + // TODO thingsKit modify update page size | |
| 702 | + // node.setAttribute('dx', Math.round(this.graph.view.translate.x * 100) / 100); | |
| 703 | + node.setAttribute('dx', Math.round(this.graph.view.translate.x)); | |
| 704 | + // node.setAttribute('dy', Math.round(this.graph.view.translate.y * 100) / 100); | |
| 705 | + node.setAttribute('dy', Math.round(this.graph.view.translate.y)); | |
| 703 | 706 | } |
| 704 | 707 | |
| 705 | 708 | node.setAttribute('grid', (this.graph.isGridEnabled()) ? '1' : '0'); |
| ... | ... | @@ -1372,7 +1375,9 @@ PrintDialog.prototype.create = function(editorUi) |
| 1372 | 1375 | function preview(print) |
| 1373 | 1376 | { |
| 1374 | 1377 | var autoOrigin = onePageCheckBox.checked || pageCountCheckBox.checked; |
| 1375 | - var printScale = parseInt(pageScaleInput.value) / 100; | |
| 1378 | + // TODO thingsKit modify update page size | |
| 1379 | + // var printScale = parseInt(pageScaleInput.value) / 100; | |
| 1380 | + var printScale = parseInt(pageScaleInput.value); | |
| 1376 | 1381 | |
| 1377 | 1382 | if (isNaN(printScale)) |
| 1378 | 1383 | { |
| ... | ... | @@ -1837,13 +1842,17 @@ PageSetupDialog.addPageFormatPanel = function(div, namePostfix, pageFormat, page |
| 1837 | 1842 | widthInput.setAttribute('size', '7'); |
| 1838 | 1843 | widthInput.style.textAlign = 'right'; |
| 1839 | 1844 | customDiv.appendChild(widthInput); |
| 1840 | - mxUtils.write(customDiv, ' in x '); | |
| 1845 | + // TODO thingsKit modify update page size | |
| 1846 | + // mxUtils.write(customDiv, ' in x '); | |
| 1847 | + mxUtils.write(customDiv, ' px/x '); | |
| 1841 | 1848 | |
| 1842 | 1849 | var heightInput = document.createElement('input'); |
| 1843 | 1850 | heightInput.setAttribute('size', '7'); |
| 1844 | 1851 | heightInput.style.textAlign = 'right'; |
| 1845 | 1852 | customDiv.appendChild(heightInput); |
| 1846 | - mxUtils.write(customDiv, ' in'); | |
| 1853 | + // mxUtils.write(customDiv, ' in'); | |
| 1854 | + // TODO thingsKit modify update page size | |
| 1855 | + mxUtils.write(customDiv, ' px/y'); | |
| 1847 | 1856 | |
| 1848 | 1857 | formatDiv.style.display = 'none'; |
| 1849 | 1858 | customDiv.style.display = 'none'; |
| ... | ... | @@ -1941,8 +1950,11 @@ PageSetupDialog.addPageFormatPanel = function(div, namePostfix, pageFormat, page |
| 1941 | 1950 | // Selects custom format which is last in list |
| 1942 | 1951 | if (!detected) |
| 1943 | 1952 | { |
| 1944 | - widthInput.value = pageFormat.width / 100; | |
| 1945 | - heightInput.value = pageFormat.height / 100; | |
| 1953 | + // TODO thingsKit modify update page size | |
| 1954 | + // widthInput.value = pageFormat.width / 100; | |
| 1955 | + widthInput.value = pageFormat.width; | |
| 1956 | + // heightInput.value = pageFormat.height / 100; | |
| 1957 | + heightInput.value = pageFormat.height; | |
| 1946 | 1958 | portraitCheckBox.setAttribute('checked', 'checked'); |
| 1947 | 1959 | paperSizeSelect.value = 'custom'; |
| 1948 | 1960 | formatDiv.style.display = 'none'; |
| ... | ... | @@ -1972,8 +1984,11 @@ PageSetupDialog.addPageFormatPanel = function(div, namePostfix, pageFormat, page |
| 1972 | 1984 | |
| 1973 | 1985 | if (f.format != null) |
| 1974 | 1986 | { |
| 1975 | - widthInput.value = f.format.width / 100; | |
| 1976 | - heightInput.value = f.format.height / 100; | |
| 1987 | + // TODO thingsKit modify update page size | |
| 1988 | + // widthInput.value = f.format.width / 100; | |
| 1989 | + widthInput.value = f.format.width; | |
| 1990 | + // heightInput.value = f.format.height / 100; | |
| 1991 | + heightInput.value = f.format.height; | |
| 1977 | 1992 | customDiv.style.display = 'none'; |
| 1978 | 1993 | formatDiv.style.display = ''; |
| 1979 | 1994 | } |
| ... | ... | @@ -1987,19 +2002,27 @@ PageSetupDialog.addPageFormatPanel = function(div, namePostfix, pageFormat, page |
| 1987 | 2002 | |
| 1988 | 2003 | if (isNaN(wi) || wi <= 0) |
| 1989 | 2004 | { |
| 1990 | - widthInput.value = pageFormat.width / 100; | |
| 2005 | + // TODO thingsKit modify update page size | |
| 2006 | + // widthInput.value = pageFormat.width / 100; | |
| 2007 | + widthInput.value = pageFormat.width; | |
| 1991 | 2008 | } |
| 1992 | 2009 | |
| 1993 | 2010 | var hi = parseFloat(heightInput.value); |
| 1994 | 2011 | |
| 1995 | 2012 | if (isNaN(hi) || hi <= 0) |
| 1996 | 2013 | { |
| 1997 | - heightInput.value = pageFormat.height / 100; | |
| 2014 | + // TODO thingsKit modify update page size | |
| 2015 | + // heightInput.value = pageFormat.height / 100; | |
| 2016 | + heightInput.value = pageFormat.height; | |
| 1998 | 2017 | } |
| 1999 | 2018 | |
| 2019 | + // TODO thingsKit modify update page size | |
| 2020 | + // var newPageFormat = new mxRectangle(0, 0, | |
| 2021 | + // Math.floor(parseFloat(widthInput.value) * 100), | |
| 2022 | + // Math.floor(parseFloat(heightInput.value) * 100)); | |
| 2000 | 2023 | var newPageFormat = new mxRectangle(0, 0, |
| 2001 | - Math.floor(parseFloat(widthInput.value) * 100), | |
| 2002 | - Math.floor(parseFloat(heightInput.value) * 100)); | |
| 2024 | + Math.floor(parseFloat(widthInput.value)), | |
| 2025 | + Math.floor(parseFloat(heightInput.value))); | |
| 2003 | 2026 | |
| 2004 | 2027 | if (paperSizeSelect.value != 'custom' && landscapeCheckBox.checked) |
| 2005 | 2028 | { | ... | ... |