Skip to content

Commit

Permalink
Merge pull request #50 from shefing/fixBugs
Browse files Browse the repository at this point in the history
fix bug - jump resize icon and scroll screen when have element in the…
  • Loading branch information
RachelBra authored Feb 25, 2024
2 parents 72d0d40 + c924b9e commit 5facfd7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
18 changes: 13 additions & 5 deletions library/math/numbersLine/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
font-display: swap;
}

body{
overflow: hidden;
}

.logo {
height: 6em;
padding: 1.5em;
Expand Down Expand Up @@ -56,17 +60,12 @@

}

:root {
--margin-value:28px;
}

.moveable-direction.moveable-e, .moveable-direction.moveable-w {
background-size: contain !important;
background-repeat: no-repeat !important;
background-position: center !important;
background-color: #ffffff00 !important;

margin: var(--margin-value) !important;
height: 18px !important;
border: 0px !important;
border-bottom-right-radius: 0px !important;
Expand All @@ -75,6 +74,15 @@
border-top-left-radius: 0px !important;
}

#dragElement-jumpBase-on .moveable-direction.moveable-e,
#dragElement-jumpBase-on .moveable-direction.moveable-w {
margin-top: 30px !important;
}

#dragElement-jumpBase-under .moveable-direction.moveable-e,
#dragElement-jumpBase-under .moveable-direction.moveable-w {
margin-top: -50px !important;
}

.moveable-direction.moveable-e{
background-image: url('../public/assets/icons/resizeRight.svg') !important;
Expand Down
6 changes: 5 additions & 1 deletion library/math/numbersLine/src/components/Jump.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const Jump = ({ element }: IProps) => {
</span>
</div>
</div>
{idDraggElementClick === element.id && <MoveableElement moveableRef={moveableRef} element={element} unit={unit} setJumpWidth={setJumpWidth} />}
{idDraggElementClick === element.id && (
<div id={`dragElement-jumpBase-${element.underRuler ? "under" : "on"}`}>
<MoveableElement moveableRef={moveableRef} element={element} unit={unit} setJumpWidth={setJumpWidth} />
</div>
)}
</>
);
};
Expand Down
2 changes: 0 additions & 2 deletions library/math/numbersLine/src/components/MoveableElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ const MoveableElement = ({ moveableRef, element, unit, setJumpWidth }: IProps) =
newYPositionString = ", " + Math.round(yTransform - 80) + "px)";
}
e.target.style.transform = e.target.style.transform.replace(yTransformString, newYPositionString);
const root = document.documentElement;
root.style.setProperty("--margin-value", `${element.underRuler ? 30 : -50}px`);
}

updateDragElements(element.id, { ...element, transform: e.target.style.transform, underRuler: isUnderRuler });
Expand Down
2 changes: 1 addition & 1 deletion library/math/numbersLine/src/components/ruler/Arrows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Arrows = () => {

dragElements.forEach((item) => {
if (item.id != idDraggElementClick) {
const element = document.getElementById("dragElement-jump" + item.id);
const element = document.getElementById(`dragElement-jump${item.id}`);
const match = element?.style.transform.match(/\((.*?)px/);
if (match && element) {
const xPosition = parseFloat(match[1]);
Expand Down
2 changes: 1 addition & 1 deletion library/math/numbersLine/src/hooks/useAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const useAction = () => {
const duplicateDragJump = async (element: IElement) => {
const id = uuidv4();
let transform = "";
const baseJump = document.getElementById("dragElement-jump" + element.id);
const baseJump = document.getElementById(`dragElement-jump${element.id}`);
let matchX = baseJump?.style.transform.match(/\((.*?)px/);
if (matchX && baseJump) {
const xPosition = parseFloat(matchX[1]);
Expand Down

0 comments on commit 5facfd7

Please sign in to comment.