From 2f7d8af994922e151ec16c873fb29456f61366e0 Mon Sep 17 00:00:00 2001 From: unpete Date: Thu, 20 May 2021 17:35:38 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=B8=D0=B7=D1=83=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20svg-dx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/drawer.js | 38 +++++++++++++++---- src/geometry/contour.js | 7 ++-- .../catalogs/cat_elm_visualization.js | 17 ++++++++- .../common/glob_products_building.js | 14 ++++++- 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/dist/drawer.js b/dist/drawer.js index 4c106818..03ef2a86 100644 --- a/dist/drawer.js +++ b/dist/drawer.js @@ -1438,13 +1438,12 @@ class Contour extends AbstractFilling(paper.Layer) { _row.furn.refill_prm(this); // двигаем по Z - const {out} = $p.enm.opening; switch(_row.furn.shtulp_kind()) { case 2: // пассивная - this.bring(this.opening === out ? 'up' : 'down'); + this.bring('down'); break; case 1: // активная - this.bring(this.opening === out ? 'down' : 'up'); + this.bring('up'); } // пересчитываем вставки и соединения, если они зависят от параметров фурнитуры @@ -2765,7 +2764,7 @@ class Contour extends AbstractFilling(paper.Layer) { function draw (elm) { if (this.elm === elm.elm && elm.visible) { - this.nom.visualization.draw(elm, l_visualization, this.len * 1000); + this.nom.visualization.draw(elm, l_visualization, this.len * 1000, this.width * 1000 * (this.alp1 || 1)); return true; } }; @@ -16705,7 +16704,19 @@ class ProductsBuilding { row_spec.qty = 0; } } - calc_count_area_mass(row_spec, spec, len_angl, row_base.angle_calc_method); + + // визуализация svg-dx + if(row_spec.dop === -1 && len_angl.curr && nom.visualization.mode === 3) { + const {sub_path, outer, profile: {generatrix}} = len_angl.curr; + const pt = generatrix.getNearestPoint(sub_path[outer ? 'lastSegment' : 'firstSegment'].point); + row_spec.width = generatrix.getOffsetOf(pt) / 1000; + if(outer) { + row_spec.alp1 = -1; + } + } + else { + calc_count_area_mass(row_spec, spec, len_angl, row_base.angle_calc_method); + } } }); @@ -19344,7 +19355,7 @@ $p.CatElm_visualization.prototype.__define({ * @param offset {Number|[Number,Number]} */ draw: { - value(elm, layer, offset) { + value(elm, layer, offset, offset0) { if(!layer.isInserted()) { return; @@ -19391,7 +19402,20 @@ $p.CatElm_visualization.prototype.__define({ } } else { - subpath = elm.generatrix.get_subpath(elm.b, elm.e).equidistant(attr.offset || 0); + if(this.mode === 3) { + const outer = offset0 < 0; + attr.offset -= -elm.d1 + elm.width; + if(outer) { + offset0 = -offset0; + attr.offset = -(attr.offset || 0); + } + const b = elm.generatrix.getPointAt(offset0 || 0); + const e = elm.generatrix.getPointAt((offset0 + offset) || elm.generatrix.length); + subpath = elm.generatrix.get_subpath(b, e).equidistant(attr.offset || 0); + } + else { + subpath = elm.generatrix.get_subpath(elm.b, elm.e).equidistant(attr.offset || 0); + } } subpath.parent = layer._by_spec; subpath.strokeWidth = attr.strokeWidth || 4; diff --git a/src/geometry/contour.js b/src/geometry/contour.js index 591a76e4..1fe317cf 100644 --- a/src/geometry/contour.js +++ b/src/geometry/contour.js @@ -455,13 +455,12 @@ class Contour extends AbstractFilling(paper.Layer) { _row.furn.refill_prm(this); // двигаем по Z - const {out} = $p.enm.opening; switch(_row.furn.shtulp_kind()) { case 2: // пассивная - this.bring(this.opening === out ? 'up' : 'down'); + this.bring('down'); break; case 1: // активная - this.bring(this.opening === out ? 'down' : 'up'); + this.bring('up'); } // пересчитываем вставки и соединения, если они зависят от параметров фурнитуры @@ -1782,7 +1781,7 @@ class Contour extends AbstractFilling(paper.Layer) { function draw (elm) { if (this.elm === elm.elm && elm.visible) { - this.nom.visualization.draw(elm, l_visualization, this.len * 1000); + this.nom.visualization.draw(elm, l_visualization, this.len * 1000, this.width * 1000 * (this.alp1 || 1)); return true; } }; diff --git a/src/modifiers/catalogs/cat_elm_visualization.js b/src/modifiers/catalogs/cat_elm_visualization.js index c47c0bd9..4e2dbbf6 100644 --- a/src/modifiers/catalogs/cat_elm_visualization.js +++ b/src/modifiers/catalogs/cat_elm_visualization.js @@ -18,7 +18,7 @@ $p.CatElm_visualization.prototype.__define({ * @param offset {Number|[Number,Number]} */ draw: { - value(elm, layer, offset) { + value(elm, layer, offset, offset0) { if(!layer.isInserted()) { return; @@ -65,7 +65,20 @@ $p.CatElm_visualization.prototype.__define({ } } else { - subpath = elm.generatrix.get_subpath(elm.b, elm.e).equidistant(attr.offset || 0); + if(this.mode === 3) { + const outer = offset0 < 0; + attr.offset -= -elm.d1 + elm.width; + if(outer) { + offset0 = -offset0; + attr.offset = -(attr.offset || 0); + } + const b = elm.generatrix.getPointAt(offset0 || 0); + const e = elm.generatrix.getPointAt((offset0 + offset) || elm.generatrix.length); + subpath = elm.generatrix.get_subpath(b, e).equidistant(attr.offset || 0); + } + else { + subpath = elm.generatrix.get_subpath(elm.b, elm.e).equidistant(attr.offset || 0); + } } subpath.parent = layer._by_spec; subpath.strokeWidth = attr.strokeWidth || 4; diff --git a/src/modifiers/common/glob_products_building.js b/src/modifiers/common/glob_products_building.js index 60ea8757..c9937bbf 100644 --- a/src/modifiers/common/glob_products_building.js +++ b/src/modifiers/common/glob_products_building.js @@ -159,7 +159,19 @@ class ProductsBuilding { row_spec.qty = 0; } } - calc_count_area_mass(row_spec, spec, len_angl, row_base.angle_calc_method); + + // визуализация svg-dx + if(row_spec.dop === -1 && len_angl.curr && nom.visualization.mode === 3) { + const {sub_path, outer, profile: {generatrix}} = len_angl.curr; + const pt = generatrix.getNearestPoint(sub_path[outer ? 'lastSegment' : 'firstSegment'].point); + row_spec.width = generatrix.getOffsetOf(pt) / 1000; + if(outer) { + row_spec.alp1 = -1; + } + } + else { + calc_count_area_mass(row_spec, spec, len_angl, row_base.angle_calc_method); + } } });