301const fastDOM = t396__initFastDOM();302303fastDOM.read(() => {304scaleData.forEach(item => {305let height = t396_elem__getFieldValue(item.element, 'height');306height = t396_elem__getHeight(item.element, height);307height = t396_elem__convertPosition__Local__toAbsolute(item.element, 'height', height);308309let width = t396_elem__getFieldValue(item.element, 'width');310width = t396_elem__getWidth(item.element, width);311width = t396_elem__convertPosition__Local__toAbsolute(item.element, 'width', width);
let top = parseFloat(t396_elem__getFieldValue(item.element, 'top')); top = t396_elem__convertPosition__Local__toAbsolute(item.element, 'top', top); let left = parseFloat(t396_elem__getFieldValue(item.element, 'left')); left = t396_elem__convertPosition__Local__toAbsolute(item.element, 'left', left); item.shapeSize = { top: top, left: left, width: width, height: height }; }); }); const smallShapes = scaleData.filter(item => item.shapeSize.width <= 2 || item.shapeSize.height <= 2); fastDOM.read(() => { smallShapes.forEach(item => { const computedStyle = window.getComputedStyle(item.elementCore); item.borderWidth = computedStyle.borderWidth; item.isImage = computedStyle.backgroundImage !== 'none'; item.isAnimated = item.element.getAttribute('data-animate-sbs-event'); }); }); fastDOM.write(() => { smallShapes.forEach(item => { if (item.borderWidth === '0px' && !item.isImage && !item.isAnimated) { item.element.style.removeProperty('zoom'); /** * Избавляемся от свойства zoom, обновляя координаты и параметры элемента * с учетом коэффициента масштабирования. */ const scaleWidth = item.shapeSize.width * item.scaleFactor; const scaleHeight = item.shapeSize.height * item.scaleFactor; const scaleTop = item.shapeSize.top * item.scaleFactor; const scaleLeft = item.shapeSize.left * item.scaleFactor; item.element.style.width = parseFloat(scaleWidth) + 'px'; item.element.style.height = parseFloat(scaleHeight) + 'px'; item.element.style.top = Math.round(scaleTop) + 'px'; item.element.style.left = Math.round(scaleLeft) + 'px'; /** * Устанавливаем атрибут так, чтобы другие функции не меняли * размер и координаты элемента */ item.element.setAttribute('data-scale-off', 'yes'); } }); });}/** * @param {HTMLElement} artBoard * @param {number} scaleFactor * @returns {Array<ScaleDataItem>} */function t396_scale__collectScaleData(artBoard, scaleFactor) { var elements = t396_scale__getElementsToScale(artBoard); return elements .map(function (element) { var elementCore = element.querySelector('.tn-molecule, .tn-atom'); var elemType = t396_scale__getElementType(element); var containerProp = t396_elem__getFieldValue(element, 'container'); if (!containerProp && elemType === 'group') containerProp = 'grid'; if (!elementCore || containerProp !== 'grid') return; return { element: element, elementCore: elementCore, elemType: elemType, scaleFactor: scaleFactor, }; }) .filter(Boolean);}/** * @param {Array<ScaleDataItem>} scaleData */function t396_scale__scaleIsOnlyScalableBlock(scaleData) { scaleData.forEach(function (item) { var elem = item.element; var elementCore = item.elementCore; var elemType = item.elemType; var scaleWrapper = elementCore.closest('.tn-atom__scale-wrapper'); var currentScaleFactor = item.scaleFactor;