Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
prettier
Sultan694a27197ba9
diff --git a/app/shared/design-system/components/primitives/numericGestureControl.js b/app/shared/design-system/components/primitives/numericGestureControl.jsindex d5ce5c2ee4..56baead1f7 100644--- a/app/shared/design-system/components/primitives/numericGestureControl.js+++ b/app/shared/design-system/components/primitives/numericGestureControl.js@@ -8,36 +8,55 @@}})*/-export const numericGestureControl = (targetNode, {- initialValue = 0,- direction = 'horizontal',- onValueChange = ({}) => null,-}) => {- const eventNames = [ 'pointerup', 'pointerdown', 'pointermove' ];- const state = { type: '', value: initialValue, cursor: direction === 'horizontal' ? 'ew-resize' : 'ns-resize' };- const handleEvent = ({ type, target, movementY, movementX, pointerId, pressure }) => {- const movement = direction === 'horizontal' ? movementX : movementY;- switch (type) {- case 'pointerup': {- targetNode.releasePointerCapture(pointerId);- break;- }- case 'pointerdown': {- targetNode.setPointerCapture(pointerId);- break;- }- case 'pointermove': {- if (pressure) onValueChange({target, value: state.value += movement, preventDefault: () => event.preventDefault()});- break;- }- }- };- targetNode.style.setProperty('cursor', state.cursor);- eventNames.forEach((eventName) => targetNode.addEventListener(eventName, handleEvent));- return {- disconnectedCallback: () => {- targetNode.style.removeProperty('cursor');- eventNames.forEach((eventName) => targetNode.removeEventListener(eventName, handleEvent))- },- };+export const numericGestureControl = (+ targetNode,+ { initialValue = 0, direction = "horizontal", onValueChange = ({}) => null }+) => {+ const eventNames = ["pointerup", "pointerdown", "pointermove"];+ const state = {+ type: "",+ value: initialValue,+ cursor: direction === "horizontal" ? "ew-resize" : "ns-resize",+ };+ const handleEvent = ({+ type,+ target,+ movementY,+ movementX,+ pointerId,+ pressure,+ }) => {+ const movement = direction === "horizontal" ? movementX : movementY;+ switch (type) {+ case "pointerup": {+ targetNode.releasePointerCapture(pointerId);+ break;+ }+ case "pointerdown": {+ targetNode.setPointerCapture(pointerId);+ break;+ }+ case "pointermove": {+ if (pressure)+ onValueChange({+ target,+ value: (state.value += movement),+ preventDefault: () => event.preventDefault(),+ });+ break;+ }+ }+ };+ targetNode.style.setProperty("cursor", state.cursor);+ eventNames.forEach((eventName) =>+ targetNode.addEventListener(eventName, handleEvent)+ );+ return {+ disconnectedCallback: () => {+ targetNode.style.removeProperty("cursor");+ eventNames.forEach((eventName) =>+ targetNode.removeEventListener(eventName, handleEvent)+ );+ },+ };};