Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: components.js
* it's easier to consider each axis individually. This function returns a bounding box
[22500] Fix | Delete
* as a map of single-axis min/max values.
[22501] Fix | Delete
*/
[22502] Fix | Delete
function convertBoundingBoxToBox({ top, left, right, bottom, }) {
[22503] Fix | Delete
return {
[22504] Fix | Delete
x: { min: left, max: right },
[22505] Fix | Delete
y: { min: top, max: bottom },
[22506] Fix | Delete
};
[22507] Fix | Delete
}
[22508] Fix | Delete
function convertBoxToBoundingBox({ x, y }) {
[22509] Fix | Delete
return { top: y.min, right: x.max, bottom: y.max, left: x.min };
[22510] Fix | Delete
}
[22511] Fix | Delete
/**
[22512] Fix | Delete
* Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
[22513] Fix | Delete
* provided by Framer to allow measured points to be corrected for device scaling. This is used
[22514] Fix | Delete
* when measuring DOM elements and DOM event points.
[22515] Fix | Delete
*/
[22516] Fix | Delete
function transformBoxPoints(point, transformPoint) {
[22517] Fix | Delete
if (!transformPoint)
[22518] Fix | Delete
return point;
[22519] Fix | Delete
const topLeft = transformPoint({ x: point.left, y: point.top });
[22520] Fix | Delete
const bottomRight = transformPoint({ x: point.right, y: point.bottom });
[22521] Fix | Delete
return {
[22522] Fix | Delete
top: topLeft.y,
[22523] Fix | Delete
left: topLeft.x,
[22524] Fix | Delete
bottom: bottomRight.y,
[22525] Fix | Delete
right: bottomRight.x,
[22526] Fix | Delete
};
[22527] Fix | Delete
}
[22528] Fix | Delete
[22529] Fix | Delete
[22530] Fix | Delete
[22531] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs
[22532] Fix | Delete
function isIdentityScale(scale) {
[22533] Fix | Delete
return scale === undefined || scale === 1;
[22534] Fix | Delete
}
[22535] Fix | Delete
function hasScale({ scale, scaleX, scaleY }) {
[22536] Fix | Delete
return (!isIdentityScale(scale) ||
[22537] Fix | Delete
!isIdentityScale(scaleX) ||
[22538] Fix | Delete
!isIdentityScale(scaleY));
[22539] Fix | Delete
}
[22540] Fix | Delete
function hasTransform(values) {
[22541] Fix | Delete
return (hasScale(values) ||
[22542] Fix | Delete
has2DTranslate(values) ||
[22543] Fix | Delete
values.z ||
[22544] Fix | Delete
values.rotate ||
[22545] Fix | Delete
values.rotateX ||
[22546] Fix | Delete
values.rotateY ||
[22547] Fix | Delete
values.skewX ||
[22548] Fix | Delete
values.skewY);
[22549] Fix | Delete
}
[22550] Fix | Delete
function has2DTranslate(values) {
[22551] Fix | Delete
return is2DTranslate(values.x) || is2DTranslate(values.y);
[22552] Fix | Delete
}
[22553] Fix | Delete
function is2DTranslate(value) {
[22554] Fix | Delete
return value && value !== "0%";
[22555] Fix | Delete
}
[22556] Fix | Delete
[22557] Fix | Delete
[22558] Fix | Delete
[22559] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs
[22560] Fix | Delete
[22561] Fix | Delete
[22562] Fix | Delete
[22563] Fix | Delete
/**
[22564] Fix | Delete
* Scales a point based on a factor and an originPoint
[22565] Fix | Delete
*/
[22566] Fix | Delete
function scalePoint(point, scale, originPoint) {
[22567] Fix | Delete
const distanceFromOrigin = point - originPoint;
[22568] Fix | Delete
const scaled = scale * distanceFromOrigin;
[22569] Fix | Delete
return originPoint + scaled;
[22570] Fix | Delete
}
[22571] Fix | Delete
/**
[22572] Fix | Delete
* Applies a translate/scale delta to a point
[22573] Fix | Delete
*/
[22574] Fix | Delete
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
[22575] Fix | Delete
if (boxScale !== undefined) {
[22576] Fix | Delete
point = scalePoint(point, boxScale, originPoint);
[22577] Fix | Delete
}
[22578] Fix | Delete
return scalePoint(point, scale, originPoint) + translate;
[22579] Fix | Delete
}
[22580] Fix | Delete
/**
[22581] Fix | Delete
* Applies a translate/scale delta to an axis
[22582] Fix | Delete
*/
[22583] Fix | Delete
function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {
[22584] Fix | Delete
axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
[22585] Fix | Delete
axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
[22586] Fix | Delete
}
[22587] Fix | Delete
/**
[22588] Fix | Delete
* Applies a translate/scale delta to a box
[22589] Fix | Delete
*/
[22590] Fix | Delete
function applyBoxDelta(box, { x, y }) {
[22591] Fix | Delete
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
[22592] Fix | Delete
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
[22593] Fix | Delete
}
[22594] Fix | Delete
/**
[22595] Fix | Delete
* Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
[22596] Fix | Delete
* in a tree upon our box before then calculating how to project it into our desired viewport-relative box
[22597] Fix | Delete
*
[22598] Fix | Delete
* This is the final nested loop within updateLayoutDelta for future refactoring
[22599] Fix | Delete
*/
[22600] Fix | Delete
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
[22601] Fix | Delete
const treeLength = treePath.length;
[22602] Fix | Delete
if (!treeLength)
[22603] Fix | Delete
return;
[22604] Fix | Delete
// Reset the treeScale
[22605] Fix | Delete
treeScale.x = treeScale.y = 1;
[22606] Fix | Delete
let node;
[22607] Fix | Delete
let delta;
[22608] Fix | Delete
for (let i = 0; i < treeLength; i++) {
[22609] Fix | Delete
node = treePath[i];
[22610] Fix | Delete
delta = node.projectionDelta;
[22611] Fix | Delete
/**
[22612] Fix | Delete
* TODO: Prefer to remove this, but currently we have motion components with
[22613] Fix | Delete
* display: contents in Framer.
[22614] Fix | Delete
*/
[22615] Fix | Delete
const instance = node.instance;
[22616] Fix | Delete
if (instance &&
[22617] Fix | Delete
instance.style &&
[22618] Fix | Delete
instance.style.display === "contents") {
[22619] Fix | Delete
continue;
[22620] Fix | Delete
}
[22621] Fix | Delete
if (isSharedTransition &&
[22622] Fix | Delete
node.options.layoutScroll &&
[22623] Fix | Delete
node.scroll &&
[22624] Fix | Delete
node !== node.root) {
[22625] Fix | Delete
transformBox(box, {
[22626] Fix | Delete
x: -node.scroll.offset.x,
[22627] Fix | Delete
y: -node.scroll.offset.y,
[22628] Fix | Delete
});
[22629] Fix | Delete
}
[22630] Fix | Delete
if (delta) {
[22631] Fix | Delete
// Incoporate each ancestor's scale into a culmulative treeScale for this component
[22632] Fix | Delete
treeScale.x *= delta.x.scale;
[22633] Fix | Delete
treeScale.y *= delta.y.scale;
[22634] Fix | Delete
// Apply each ancestor's calculated delta into this component's recorded layout box
[22635] Fix | Delete
applyBoxDelta(box, delta);
[22636] Fix | Delete
}
[22637] Fix | Delete
if (isSharedTransition && hasTransform(node.latestValues)) {
[22638] Fix | Delete
transformBox(box, node.latestValues);
[22639] Fix | Delete
}
[22640] Fix | Delete
}
[22641] Fix | Delete
/**
[22642] Fix | Delete
* Snap tree scale back to 1 if it's within a non-perceivable threshold.
[22643] Fix | Delete
* This will help reduce useless scales getting rendered.
[22644] Fix | Delete
*/
[22645] Fix | Delete
treeScale.x = snapToDefault(treeScale.x);
[22646] Fix | Delete
treeScale.y = snapToDefault(treeScale.y);
[22647] Fix | Delete
}
[22648] Fix | Delete
function snapToDefault(scale) {
[22649] Fix | Delete
if (Number.isInteger(scale))
[22650] Fix | Delete
return scale;
[22651] Fix | Delete
return scale > 1.0000000000001 || scale < 0.999999999999 ? scale : 1;
[22652] Fix | Delete
}
[22653] Fix | Delete
function translateAxis(axis, distance) {
[22654] Fix | Delete
axis.min = axis.min + distance;
[22655] Fix | Delete
axis.max = axis.max + distance;
[22656] Fix | Delete
}
[22657] Fix | Delete
/**
[22658] Fix | Delete
* Apply a transform to an axis from the latest resolved motion values.
[22659] Fix | Delete
* This function basically acts as a bridge between a flat motion value map
[22660] Fix | Delete
* and applyAxisDelta
[22661] Fix | Delete
*/
[22662] Fix | Delete
function transformAxis(axis, transforms, [key, scaleKey, originKey]) {
[22663] Fix | Delete
const axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
[22664] Fix | Delete
const originPoint = mixNumber(axis.min, axis.max, axisOrigin);
[22665] Fix | Delete
// Apply the axis delta to the final axis
[22666] Fix | Delete
applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
[22667] Fix | Delete
}
[22668] Fix | Delete
/**
[22669] Fix | Delete
* The names of the motion values we want to apply as translation, scale and origin.
[22670] Fix | Delete
*/
[22671] Fix | Delete
const xKeys = ["x", "scaleX", "originX"];
[22672] Fix | Delete
const yKeys = ["y", "scaleY", "originY"];
[22673] Fix | Delete
/**
[22674] Fix | Delete
* Apply a transform to a box from the latest resolved motion values.
[22675] Fix | Delete
*/
[22676] Fix | Delete
function transformBox(box, transform) {
[22677] Fix | Delete
transformAxis(box.x, transform, xKeys);
[22678] Fix | Delete
transformAxis(box.y, transform, yKeys);
[22679] Fix | Delete
}
[22680] Fix | Delete
[22681] Fix | Delete
[22682] Fix | Delete
[22683] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/measure.mjs
[22684] Fix | Delete
[22685] Fix | Delete
[22686] Fix | Delete
[22687] Fix | Delete
function measureViewportBox(instance, transformPoint) {
[22688] Fix | Delete
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
[22689] Fix | Delete
}
[22690] Fix | Delete
function measurePageBox(element, rootProjectionNode, transformPagePoint) {
[22691] Fix | Delete
const viewportBox = measureViewportBox(element, transformPagePoint);
[22692] Fix | Delete
const { scroll } = rootProjectionNode;
[22693] Fix | Delete
if (scroll) {
[22694] Fix | Delete
translateAxis(viewportBox.x, scroll.offset.x);
[22695] Fix | Delete
translateAxis(viewportBox.y, scroll.offset.y);
[22696] Fix | Delete
}
[22697] Fix | Delete
return viewportBox;
[22698] Fix | Delete
}
[22699] Fix | Delete
[22700] Fix | Delete
[22701] Fix | Delete
[22702] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/get-context-window.mjs
[22703] Fix | Delete
// Fixes https://github.com/framer/motion/issues/2270
[22704] Fix | Delete
const getContextWindow = ({ current }) => {
[22705] Fix | Delete
return current ? current.ownerDocument.defaultView : null;
[22706] Fix | Delete
};
[22707] Fix | Delete
[22708] Fix | Delete
[22709] Fix | Delete
[22710] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs
[22711] Fix | Delete
[22712] Fix | Delete
[22713] Fix | Delete
[22714] Fix | Delete
[22715] Fix | Delete
[22716] Fix | Delete
[22717] Fix | Delete
[22718] Fix | Delete
[22719] Fix | Delete
[22720] Fix | Delete
[22721] Fix | Delete
[22722] Fix | Delete
[22723] Fix | Delete
[22724] Fix | Delete
[22725] Fix | Delete
[22726] Fix | Delete
[22727] Fix | Delete
[22728] Fix | Delete
[22729] Fix | Delete
[22730] Fix | Delete
const elementDragControls = new WeakMap();
[22731] Fix | Delete
/**
[22732] Fix | Delete
*
[22733] Fix | Delete
*/
[22734] Fix | Delete
// let latestPointerEvent: PointerEvent
[22735] Fix | Delete
class VisualElementDragControls {
[22736] Fix | Delete
constructor(visualElement) {
[22737] Fix | Delete
// This is a reference to the global drag gesture lock, ensuring only one component
[22738] Fix | Delete
// can "capture" the drag of one or both axes.
[22739] Fix | Delete
// TODO: Look into moving this into pansession?
[22740] Fix | Delete
this.openGlobalLock = null;
[22741] Fix | Delete
this.isDragging = false;
[22742] Fix | Delete
this.currentDirection = null;
[22743] Fix | Delete
this.originPoint = { x: 0, y: 0 };
[22744] Fix | Delete
/**
[22745] Fix | Delete
* The permitted boundaries of travel, in pixels.
[22746] Fix | Delete
*/
[22747] Fix | Delete
this.constraints = false;
[22748] Fix | Delete
this.hasMutatedConstraints = false;
[22749] Fix | Delete
/**
[22750] Fix | Delete
* The per-axis resolved elastic values.
[22751] Fix | Delete
*/
[22752] Fix | Delete
this.elastic = createBox();
[22753] Fix | Delete
this.visualElement = visualElement;
[22754] Fix | Delete
}
[22755] Fix | Delete
start(originEvent, { snapToCursor = false } = {}) {
[22756] Fix | Delete
/**
[22757] Fix | Delete
* Don't start dragging if this component is exiting
[22758] Fix | Delete
*/
[22759] Fix | Delete
const { presenceContext } = this.visualElement;
[22760] Fix | Delete
if (presenceContext && presenceContext.isPresent === false)
[22761] Fix | Delete
return;
[22762] Fix | Delete
const onSessionStart = (event) => {
[22763] Fix | Delete
const { dragSnapToOrigin } = this.getProps();
[22764] Fix | Delete
// Stop or pause any animations on both axis values immediately. This allows the user to throw and catch
[22765] Fix | Delete
// the component.
[22766] Fix | Delete
dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
[22767] Fix | Delete
if (snapToCursor) {
[22768] Fix | Delete
this.snapToCursor(extractEventInfo(event, "page").point);
[22769] Fix | Delete
}
[22770] Fix | Delete
};
[22771] Fix | Delete
const onStart = (event, info) => {
[22772] Fix | Delete
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
[22773] Fix | Delete
const { drag, dragPropagation, onDragStart } = this.getProps();
[22774] Fix | Delete
if (drag && !dragPropagation) {
[22775] Fix | Delete
if (this.openGlobalLock)
[22776] Fix | Delete
this.openGlobalLock();
[22777] Fix | Delete
this.openGlobalLock = getGlobalLock(drag);
[22778] Fix | Delete
// If we don 't have the lock, don't start dragging
[22779] Fix | Delete
if (!this.openGlobalLock)
[22780] Fix | Delete
return;
[22781] Fix | Delete
}
[22782] Fix | Delete
this.isDragging = true;
[22783] Fix | Delete
this.currentDirection = null;
[22784] Fix | Delete
this.resolveConstraints();
[22785] Fix | Delete
if (this.visualElement.projection) {
[22786] Fix | Delete
this.visualElement.projection.isAnimationBlocked = true;
[22787] Fix | Delete
this.visualElement.projection.target = undefined;
[22788] Fix | Delete
}
[22789] Fix | Delete
/**
[22790] Fix | Delete
* Record gesture origin
[22791] Fix | Delete
*/
[22792] Fix | Delete
eachAxis((axis) => {
[22793] Fix | Delete
let current = this.getAxisMotionValue(axis).get() || 0;
[22794] Fix | Delete
/**
[22795] Fix | Delete
* If the MotionValue is a percentage value convert to px
[22796] Fix | Delete
*/
[22797] Fix | Delete
if (percent.test(current)) {
[22798] Fix | Delete
const { projection } = this.visualElement;
[22799] Fix | Delete
if (projection && projection.layout) {
[22800] Fix | Delete
const measuredAxis = projection.layout.layoutBox[axis];
[22801] Fix | Delete
if (measuredAxis) {
[22802] Fix | Delete
const length = calcLength(measuredAxis);
[22803] Fix | Delete
current = length * (parseFloat(current) / 100);
[22804] Fix | Delete
}
[22805] Fix | Delete
}
[22806] Fix | Delete
}
[22807] Fix | Delete
this.originPoint[axis] = current;
[22808] Fix | Delete
});
[22809] Fix | Delete
// Fire onDragStart event
[22810] Fix | Delete
if (onDragStart) {
[22811] Fix | Delete
frame_frame.postRender(() => onDragStart(event, info));
[22812] Fix | Delete
}
[22813] Fix | Delete
const { animationState } = this.visualElement;
[22814] Fix | Delete
animationState && animationState.setActive("whileDrag", true);
[22815] Fix | Delete
};
[22816] Fix | Delete
const onMove = (event, info) => {
[22817] Fix | Delete
// latestPointerEvent = event
[22818] Fix | Delete
const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
[22819] Fix | Delete
// If we didn't successfully receive the gesture lock, early return.
[22820] Fix | Delete
if (!dragPropagation && !this.openGlobalLock)
[22821] Fix | Delete
return;
[22822] Fix | Delete
const { offset } = info;
[22823] Fix | Delete
// Attempt to detect drag direction if directionLock is true
[22824] Fix | Delete
if (dragDirectionLock && this.currentDirection === null) {
[22825] Fix | Delete
this.currentDirection = getCurrentDirection(offset);
[22826] Fix | Delete
// If we've successfully set a direction, notify listener
[22827] Fix | Delete
if (this.currentDirection !== null) {
[22828] Fix | Delete
onDirectionLock && onDirectionLock(this.currentDirection);
[22829] Fix | Delete
}
[22830] Fix | Delete
return;
[22831] Fix | Delete
}
[22832] Fix | Delete
// Update each point with the latest position
[22833] Fix | Delete
this.updateAxis("x", info.point, offset);
[22834] Fix | Delete
this.updateAxis("y", info.point, offset);
[22835] Fix | Delete
/**
[22836] Fix | Delete
* Ideally we would leave the renderer to fire naturally at the end of
[22837] Fix | Delete
* this frame but if the element is about to change layout as the result
[22838] Fix | Delete
* of a re-render we want to ensure the browser can read the latest
[22839] Fix | Delete
* bounding box to ensure the pointer and element don't fall out of sync.
[22840] Fix | Delete
*/
[22841] Fix | Delete
this.visualElement.render();
[22842] Fix | Delete
/**
[22843] Fix | Delete
* This must fire after the render call as it might trigger a state
[22844] Fix | Delete
* change which itself might trigger a layout update.
[22845] Fix | Delete
*/
[22846] Fix | Delete
onDrag && onDrag(event, info);
[22847] Fix | Delete
};
[22848] Fix | Delete
const onSessionEnd = (event, info) => this.stop(event, info);
[22849] Fix | Delete
const resumeAnimation = () => eachAxis((axis) => {
[22850] Fix | Delete
var _a;
[22851] Fix | Delete
return this.getAnimationState(axis) === "paused" &&
[22852] Fix | Delete
((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
[22853] Fix | Delete
});
[22854] Fix | Delete
const { dragSnapToOrigin } = this.getProps();
[22855] Fix | Delete
this.panSession = new PanSession(originEvent, {
[22856] Fix | Delete
onSessionStart,
[22857] Fix | Delete
onStart,
[22858] Fix | Delete
onMove,
[22859] Fix | Delete
onSessionEnd,
[22860] Fix | Delete
resumeAnimation,
[22861] Fix | Delete
}, {
[22862] Fix | Delete
transformPagePoint: this.visualElement.getTransformPagePoint(),
[22863] Fix | Delete
dragSnapToOrigin,
[22864] Fix | Delete
contextWindow: getContextWindow(this.visualElement),
[22865] Fix | Delete
});
[22866] Fix | Delete
}
[22867] Fix | Delete
stop(event, info) {
[22868] Fix | Delete
const isDragging = this.isDragging;
[22869] Fix | Delete
this.cancel();
[22870] Fix | Delete
if (!isDragging)
[22871] Fix | Delete
return;
[22872] Fix | Delete
const { velocity } = info;
[22873] Fix | Delete
this.startAnimation(velocity);
[22874] Fix | Delete
const { onDragEnd } = this.getProps();
[22875] Fix | Delete
if (onDragEnd) {
[22876] Fix | Delete
frame_frame.postRender(() => onDragEnd(event, info));
[22877] Fix | Delete
}
[22878] Fix | Delete
}
[22879] Fix | Delete
cancel() {
[22880] Fix | Delete
this.isDragging = false;
[22881] Fix | Delete
const { projection, animationState } = this.visualElement;
[22882] Fix | Delete
if (projection) {
[22883] Fix | Delete
projection.isAnimationBlocked = false;
[22884] Fix | Delete
}
[22885] Fix | Delete
this.panSession && this.panSession.end();
[22886] Fix | Delete
this.panSession = undefined;
[22887] Fix | Delete
const { dragPropagation } = this.getProps();
[22888] Fix | Delete
if (!dragPropagation && this.openGlobalLock) {
[22889] Fix | Delete
this.openGlobalLock();
[22890] Fix | Delete
this.openGlobalLock = null;
[22891] Fix | Delete
}
[22892] Fix | Delete
animationState && animationState.setActive("whileDrag", false);
[22893] Fix | Delete
}
[22894] Fix | Delete
updateAxis(axis, _point, offset) {
[22895] Fix | Delete
const { drag } = this.getProps();
[22896] Fix | Delete
// If we're not dragging this axis, do an early return.
[22897] Fix | Delete
if (!offset || !shouldDrag(axis, drag, this.currentDirection))
[22898] Fix | Delete
return;
[22899] Fix | Delete
const axisValue = this.getAxisMotionValue(axis);
[22900] Fix | Delete
let next = this.originPoint[axis] + offset[axis];
[22901] Fix | Delete
// Apply constraints
[22902] Fix | Delete
if (this.constraints && this.constraints[axis]) {
[22903] Fix | Delete
next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
[22904] Fix | Delete
}
[22905] Fix | Delete
axisValue.set(next);
[22906] Fix | Delete
}
[22907] Fix | Delete
resolveConstraints() {
[22908] Fix | Delete
var _a;
[22909] Fix | Delete
const { dragConstraints, dragElastic } = this.getProps();
[22910] Fix | Delete
const layout = this.visualElement.projection &&
[22911] Fix | Delete
!this.visualElement.projection.layout
[22912] Fix | Delete
? this.visualElement.projection.measure(false)
[22913] Fix | Delete
: (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
[22914] Fix | Delete
const prevConstraints = this.constraints;
[22915] Fix | Delete
if (dragConstraints && isRefObject(dragConstraints)) {
[22916] Fix | Delete
if (!this.constraints) {
[22917] Fix | Delete
this.constraints = this.resolveRefConstraints();
[22918] Fix | Delete
}
[22919] Fix | Delete
}
[22920] Fix | Delete
else {
[22921] Fix | Delete
if (dragConstraints && layout) {
[22922] Fix | Delete
this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);
[22923] Fix | Delete
}
[22924] Fix | Delete
else {
[22925] Fix | Delete
this.constraints = false;
[22926] Fix | Delete
}
[22927] Fix | Delete
}
[22928] Fix | Delete
this.elastic = resolveDragElastic(dragElastic);
[22929] Fix | Delete
/**
[22930] Fix | Delete
* If we're outputting to external MotionValues, we want to rebase the measured constraints
[22931] Fix | Delete
* from viewport-relative to component-relative.
[22932] Fix | Delete
*/
[22933] Fix | Delete
if (prevConstraints !== this.constraints &&
[22934] Fix | Delete
layout &&
[22935] Fix | Delete
this.constraints &&
[22936] Fix | Delete
!this.hasMutatedConstraints) {
[22937] Fix | Delete
eachAxis((axis) => {
[22938] Fix | Delete
if (this.constraints !== false &&
[22939] Fix | Delete
this.getAxisMotionValue(axis)) {
[22940] Fix | Delete
this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);
[22941] Fix | Delete
}
[22942] Fix | Delete
});
[22943] Fix | Delete
}
[22944] Fix | Delete
}
[22945] Fix | Delete
resolveRefConstraints() {
[22946] Fix | Delete
const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
[22947] Fix | Delete
if (!constraints || !isRefObject(constraints))
[22948] Fix | Delete
return false;
[22949] Fix | Delete
const constraintsElement = constraints.current;
[22950] Fix | Delete
errors_invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
[22951] Fix | Delete
const { projection } = this.visualElement;
[22952] Fix | Delete
// TODO
[22953] Fix | Delete
if (!projection || !projection.layout)
[22954] Fix | Delete
return false;
[22955] Fix | Delete
const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
[22956] Fix | Delete
let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
[22957] Fix | Delete
/**
[22958] Fix | Delete
* If there's an onMeasureDragConstraints listener we call it and
[22959] Fix | Delete
* if different constraints are returned, set constraints to that
[22960] Fix | Delete
*/
[22961] Fix | Delete
if (onMeasureDragConstraints) {
[22962] Fix | Delete
const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
[22963] Fix | Delete
this.hasMutatedConstraints = !!userConstraints;
[22964] Fix | Delete
if (userConstraints) {
[22965] Fix | Delete
measuredConstraints = convertBoundingBoxToBox(userConstraints);
[22966] Fix | Delete
}
[22967] Fix | Delete
}
[22968] Fix | Delete
return measuredConstraints;
[22969] Fix | Delete
}
[22970] Fix | Delete
startAnimation(velocity) {
[22971] Fix | Delete
const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
[22972] Fix | Delete
const constraints = this.constraints || {};
[22973] Fix | Delete
const momentumAnimations = eachAxis((axis) => {
[22974] Fix | Delete
if (!shouldDrag(axis, drag, this.currentDirection)) {
[22975] Fix | Delete
return;
[22976] Fix | Delete
}
[22977] Fix | Delete
let transition = (constraints && constraints[axis]) || {};
[22978] Fix | Delete
if (dragSnapToOrigin)
[22979] Fix | Delete
transition = { min: 0, max: 0 };
[22980] Fix | Delete
/**
[22981] Fix | Delete
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
[22982] Fix | Delete
* of spring animations so we should look into adding a disable spring option to `inertia`.
[22983] Fix | Delete
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
[22984] Fix | Delete
* using the value of `dragElastic`.
[22985] Fix | Delete
*/
[22986] Fix | Delete
const bounceStiffness = dragElastic ? 200 : 1000000;
[22987] Fix | Delete
const bounceDamping = dragElastic ? 40 : 10000000;
[22988] Fix | Delete
const inertia = {
[22989] Fix | Delete
type: "inertia",
[22990] Fix | Delete
velocity: dragMomentum ? velocity[axis] : 0,
[22991] Fix | Delete
bounceStiffness,
[22992] Fix | Delete
bounceDamping,
[22993] Fix | Delete
timeConstant: 750,
[22994] Fix | Delete
restDelta: 1,
[22995] Fix | Delete
restSpeed: 10,
[22996] Fix | Delete
...dragTransition,
[22997] Fix | Delete
...transition,
[22998] Fix | Delete
};
[22999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function