Skip to content

Commit

Permalink
fix(adaptation): Dark theme bug & incorrect appearance of graphing mo…
Browse files Browse the repository at this point in the history
…de & fix: Functional error of graphing mode in mobile client
  • Loading branch information
NriotHrreion committed May 18, 2024
1 parent 97eb5c6 commit 06cd42e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/InputButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const InputButton: React.FC<InputButtonProps> = (props) => {
const inputValue = props.inputValue ?? props.symbol;
const id = useId();

const clickHandle = () => {
const handleClick = () => {
if(props.onClick) {
props.onClick();
return;
Expand All @@ -48,7 +48,7 @@ const InputButton: React.FC<InputButtonProps> = (props) => {
<div className="keypad-button-container" style={{ flexGrow: props.grow }}>
<button
className="keypad-button"
onClick={() => clickHandle()}
onClick={() => handleClick()}
disabled={disabled}
style={props.style}
tabIndex={-1}
Expand Down
5 changes: 3 additions & 2 deletions src/components/sidebar/FunctionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const FunctionList: React.FC = () => {

switch(symbol) {
case "Backspace":
case "\\text{Del}":
ctx.backspace();
break;
case "Enter":
Expand Down Expand Up @@ -194,13 +195,13 @@ const FunctionList: React.FC = () => {

return (
<>
<SidebarPage
{!Utils.isMobile() && <SidebarPage
id="function-list"
title="函数列表"
tip={<>最多添加{maxFunctionAmount}个函数</>}
onContextMenu={onContextMenu}>
<div className="function-list-main">{mainSection}</div>
</SidebarPage>
</SidebarPage>}
{contextMenu}

{/* Portal to `/src/views/graphing/index.tsx` */}
Expand Down
11 changes: 10 additions & 1 deletion src/style/adaptation/mobile.less
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}
.mobile-input-container {
display: flex;
background-color: #fff;
background-color: var(--ca-light1);
}
.graphing-container {
height: 49%;
Expand All @@ -107,6 +107,15 @@
}
.mobile-graphing-input-container {
display: flex;
.function-input-box .function-input-box-tag {
margin-left: 25px;
.select {
width: 50px;
.select-item {
padding-top: 8px;
}
}
}
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/style/calculator/calculator.less
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@
flex-direction: column;
justify-content: space-between;
height: 100%;
.keypad-tab-name {
color: var(--ca-gray7);
}
color: var(--ca-gray7);
}
&.open .keypad-tab-name {
color: var(--ca-gray-light);
Expand Down Expand Up @@ -223,7 +221,7 @@
height: 50px;
margin-right: 3px;
.keypad-button {
background-color: var(--ca-gray5) !important;
background-color: transparent !important;
.button-style();
span {
font-size: 12pt;
Expand Down
2 changes: 1 addition & 1 deletion src/style/calculator/graphing.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
flex-direction: column;
width: 100%;
height: 0;
background-color: #fff;
background-color: var(--ca-light1);
.function-input-box {
display: flex;
padding: 7px 0;
Expand Down
1 change: 1 addition & 0 deletions src/style/sidebar.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
text-align: center;
border-bottom: 1px solid var(--ca-gray2);
white-space: nowrap;
color: var(--ca-gray-light);
}
.mode-switcher-wrapper {
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions src/views/graphing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ const Graphing: React.FC = memo(() => {
});
canvas.addEventListener("touchend", () => {
if(!workerRef.current) return;
workerRef.current.postMessage({ type: "mouse-leave" });
workerRef.current.postMessage({ type: "mouse-up" });
});
canvas.addEventListener("touchcancel", () => {
if(!workerRef.current) return;
workerRef.current.postMessage({ type: "mouse-leave" });
workerRef.current.postMessage({ type: "mouse-up" });
});

// "graphing-reload" cannot be moved into `useEmitter` hook
Expand Down
4 changes: 2 additions & 2 deletions src/views/programming/NumberBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface NumberBoxProps {
const NumberBox: React.FC<NumberBoxProps> = (props) => {
const [isActive, setIsActive] = useState<boolean>(false);

const clickHandle = () => {
const handleClick = () => {
new Emitter().emit("number-sys-chose", props.type);
};

Expand All @@ -24,7 +24,7 @@ const NumberBox: React.FC<NumberBoxProps> = (props) => {
}, []);

return (
<li className={"number-box"+ (isActive ? " active" : "")} onClick={() => clickHandle()}>
<li className={"number-box"+ (isActive ? " active" : "")} onClick={() => handleClick()}>
<span className="name">{Utils.firstLetterUpperCase(props.type)}</span>
<span className="number">{props.value}</span>
</li>
Expand Down

1 comment on commit 06cd42e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.