Skip to content

Commit

Permalink
Fix off by one errors
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed Mar 20, 2024
1 parent 07212b2 commit 549c580
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/src/components/renderer/map-parser/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import interpolate from "color-interpolate";
import { EditorProps } from "components/Editor";
import { FeaturePickerButton } from "components/app-bar/FeaturePickerButton";
import { Option } from "components/layer-editor/Option";
import { find, flow, set, sortBy, startCase } from "lodash";
import { find, flow, round, set, sortBy, startCase } from "lodash";
import PopupState, { bindPopover, bindTrigger } from "material-ui-popup-state";
import memo from "memoizee";
import { getClosestColor } from "nearest-pantone";
Expand Down Expand Up @@ -156,7 +156,7 @@ export const hydrate: ParsedMapHydrator = (result) => {
return {
...result,
snap: ({ x: x1, y: y1 }, scale = 1) => {
const [x, y] = [floor(x1 + scale / 2), floor(y1 + scale / 2)];
const [x, y] = [round(-1 + x1 + scale / 2), round(-1 + y1 + scale / 2)];
if (between(x, 0, width) && between(y, 0, height)) return { x, y };
},
nodeAt: (point) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function parse({
return { persistent, transient };
})
.map((c) => mapValues(c, (b) => b.filter(isVisible)))
.map((c, i) => mapValues(c, (b) => b.map(makeEntryIteratee(i))))
.map((c, i) => mapValues(c, (b) => b.map(makeEntryIteratee(from + i))))
.value();
return {
stepsPersistent: map(steps, (c) => c.persistent),
Expand Down

0 comments on commit 549c580

Please sign in to comment.