Skip to content

Commit

Permalink
fix: vary region canvas to base64 color
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Aug 8, 2024
1 parent c61aeb2 commit 39ecfdf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/components/mj/mask-editor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const toMask = (canvas: HTMLCanvasElement) => {
if (imageData) {
for (var i = 0; i < imageData?.data.length; i += 4) {
const pixelColor =
imageData.data[i] === 255 ? [255, 255, 255] : [0, 0, 0];
imageData.data[i] === 255 ? [0, 0, 0] : [255, 255, 255];
imageData.data[i] = pixelColor[0];
imageData.data[i + 1] = pixelColor[1];
imageData.data[i + 2] = pixelColor[2];
Expand Down
14 changes: 13 additions & 1 deletion app/components/mj/mj.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
showConfirm,
showImageModal,
showModal,
showToast,
} from "@/app/components/ui-lib";
import { removeImage } from "@/app/utils/chat";
import { SideBar } from "./mj-sidebar";
Expand Down Expand Up @@ -366,6 +367,15 @@ export function Mj() {
.SubmitRegion
}
onClick={() => {
if (!inputText) {
showToast(
Locales.MjPanel.ParamIsRequired(
Locales.MjPanel
.Prompt,
),
);
return;
}
mjStore.sendTask(
{
action: "action",
Expand Down Expand Up @@ -419,7 +429,9 @@ export function Mj() {
width: "100%",
}}
type="text"
placeholder="Prompt"
placeholder={
Locales.MjPanel.Prompt
}
className={
styles[
"user-prompt-search"
Expand Down
1 change: 0 additions & 1 deletion app/store/mj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export const useMjStore = createPersistStore<
});
call && call(null);
if (!opt?.dontFetchStatus) {
console.log("fetch status", opt);
this.intervalFetchStatus(id, taskId, opt);
}
} else {
Expand Down

0 comments on commit 39ecfdf

Please sign in to comment.