Skip to content

Commit

Permalink
refactor: remove unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Mar 5, 2024
1 parent f142789 commit 264ae95
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/state/dimension-marshal/get-initial-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default ({
}: Args): StartPublishingResult => {
const timingKey = 'Initial collection from DOM';
timings.start(timingKey);
const viewport: Viewport = getViewport(critical);
const viewport: Viewport = getViewport();
const windowScroll: Position = viewport.scroll.current;

const home: DroppableDescriptor = critical.droppable;
Expand Down
1 change: 0 additions & 1 deletion src/state/get-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ import type { DroppableDimension, Scrollable } from '../types';
export default (droppable: DroppableDimension): Scrollable => {
const frame: Scrollable | null = droppable.frame;
invariant(frame, 'Expected Droppable to have a frame');

return frame;
};
2 changes: 1 addition & 1 deletion src/state/move-in-direction/move-cross-axis/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Position } from 'css-box-model';
import type { Position } from 'css-box-model';
import type { PublicResult } from '../move-in-direction-types';
import type {
DroppableDimension,
Expand Down
4 changes: 2 additions & 2 deletions src/state/move-in-direction/move-to-next-place/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import isHomeOf from '../../droppable/is-home-of';
import getPageBorderBoxCenter from '../../get-center-from-impact/get-page-border-box-center';
import speculativelyIncrease from '../../update-displacement-visibility/speculatively-increase';
import getClientFromPageBorderBoxCenter from '../../get-center-from-impact/get-client-border-box-center/get-client-from-page-border-box-center';
import { add, subtract } from '../../position';
import { subtract } from '../../position';
import isTotallyVisibleInNewLocation from './is-totally-visible-in-new-location';

interface Args {
Expand Down Expand Up @@ -103,7 +103,6 @@ export default ({
draggable,
viewport,
});

return {
clientSelection,
impact,
Expand All @@ -123,6 +122,7 @@ export default ({
draggables,
maxScrollChange: distance,
});

return {
clientSelection: previousClientSelection,
impact: cautious,
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ export interface Viewport {
// live updates with the latest values
frame: Rect;
scroll: ScrollDetails;
offset: Rect;
}

export interface LiftEffect {
Expand Down
6 changes: 0 additions & 6 deletions src/view/use-sensor-marshal/sensors/util/offset-point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export default function offsetPoint(
y: number,
win: Window,
): Position {
// const { clientX, clientY } = event;

// const win = event.currentTarget as Window;

let offsetX = 0;
let offsetY = 0;

Expand Down Expand Up @@ -38,8 +34,6 @@ export default function offsetPoint(
y: transformedY + offsetY,
};

console.log(transformedX, transformedY);

return point;
}
}
Expand Down
16 changes: 2 additions & 14 deletions src/view/window/get-viewport.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { getRect } from 'css-box-model';
import type { Rect, Position } from 'css-box-model';
import type { Critical, Viewport } from '../../types';
import type { Viewport } from '../../types';
import { origin } from '../../state/position';
import getWindowScroll from './get-window-scroll';
import getMaxWindowScroll from './get-max-window-scroll';
import getDocumentElement from '../get-document-element';
import getIframeOffset from '../iframe/get-iframe-offset';
import querySelectorAllIframe from '../iframe/query-selector-all-iframe';
import { prefix } from '../data-attributes';
import applyOffset from '../iframe/apply-offset';

export default (critical?: Critical): Viewport => {
export default (): Viewport => {
const scroll: Position = getWindowScroll();
const maxScroll: Position = getMaxWindowScroll();

Expand All @@ -36,13 +32,6 @@ export default (critical?: Critical): Viewport => {
bottom,
});

const droppables = querySelectorAllIframe(
`[${prefix}-droppable-id="${critical?.droppable.id}"]`,
);

const offset = getIframeOffset(droppables[0]);
const offsetFrame = applyOffset(frame, offset);

const viewport: Viewport = {
frame,
scroll: {
Expand All @@ -54,7 +43,6 @@ export default (critical?: Critical): Viewport => {
displacement: origin,
},
},
offset: offsetFrame,
};

return viewport;
Expand Down

0 comments on commit 264ae95

Please sign in to comment.