/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import"../../../../../../core/has.js";import{isDiagonalResizeHandle as t}from"../../../../analysis/Slice/sliceToolUtils.js";import{EventPipeline as e}from"../../../../../interactive/dragEventPipeline.js";class a{constructor(){this._lastDragEvent=null,this._next=null,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&null!=this._lastDragEvent&&null!=this._next){const e={...this._lastDragEvent,action:"update"};t&&n(e),this._next.execute(e)}this._enabled=t}createDragEventPipelineStep(){this._lastDragEvent=null;const t=new e;return this._next=t,[t=>(this._lastDragEvent="end"!==t.action?{...t}:null,this._enabled&&n(t),t),t]}get test(){}}function n(e){const a=t(e.handle)?Math.max(Math.abs(e.factor1),Math.abs(e.factor2)):0===e.handle.direction[0]?Math.abs(e.factor2):Math.abs(e.factor1);e.factor1=e.factor1<0?-a:a,e.factor2=e.factor2<0?-a:a}export{a as PreserveAspectRatio};
