mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Fix IO editor always starting in "hide all, guess one" mode (#3709)
* update backend * set hideAllGuessOne in mask editor instead
This commit is contained in:
parent
c4ad27a2db
commit
b6d7bb190d
4 changed files with 12 additions and 8 deletions
|
@ -76,6 +76,7 @@ message GetImageOcclusionNoteResponse {
|
||||||
string back_extra = 4;
|
string back_extra = 4;
|
||||||
repeated string tags = 5;
|
repeated string tags = 5;
|
||||||
string image_file_name = 6;
|
string image_file_name = 6;
|
||||||
|
bool occlude_inactive = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
oneof value {
|
oneof value {
|
||||||
|
|
|
@ -97,6 +97,14 @@ impl Collection {
|
||||||
let idxs = nt.get_io_field_indexes()?;
|
let idxs = nt.get_io_field_indexes()?;
|
||||||
|
|
||||||
cloze_note.occlusions = parse_image_occlusions(fields[idxs.occlusions as usize].as_str());
|
cloze_note.occlusions = parse_image_occlusions(fields[idxs.occlusions as usize].as_str());
|
||||||
|
cloze_note.occlude_inactive = cloze_note.occlusions.iter().any(|oc| {
|
||||||
|
oc.shapes.iter().any(|sh| {
|
||||||
|
sh.properties
|
||||||
|
.iter()
|
||||||
|
.find(|p| p.name == "oi")
|
||||||
|
.is_some_and(|p| p.value == "1")
|
||||||
|
})
|
||||||
|
});
|
||||||
cloze_note.header.clone_from(&fields[idxs.header as usize]);
|
cloze_note.header.clone_from(&fields[idxs.header as usize]);
|
||||||
cloze_note
|
cloze_note
|
||||||
.back_extra
|
.back_extra
|
||||||
|
|
|
@ -445,13 +445,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const clozeNote = get(fieldStores[ioFields.occlusions]);
|
|
||||||
if (clozeNote.includes("oi=1")) {
|
|
||||||
$hideAllGuessOne = true;
|
|
||||||
} else {
|
|
||||||
$hideAllGuessOne = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isIOImageLoaded = true;
|
isIOImageLoaded = true;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { fabric } from "fabric";
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
import { optimumCssSizeForCanvas } from "./canvas-scale";
|
import { optimumCssSizeForCanvas } from "./canvas-scale";
|
||||||
import { notesDataStore, saveNeededStore, tagsWritable, textEditingState } from "./store";
|
import { hideAllGuessOne, notesDataStore, saveNeededStore, tagsWritable, textEditingState } from "./store";
|
||||||
import Toast from "./Toast.svelte";
|
import Toast from "./Toast.svelte";
|
||||||
import { addShapesToCanvasFromCloze } from "./tools/add-from-cloze";
|
import { addShapesToCanvasFromCloze } from "./tools/add-from-cloze";
|
||||||
import { enableSelectable, makeShapesRemainInCanvas, moveShapeToCanvasBoundaries } from "./tools/lib";
|
import { enableSelectable, makeShapesRemainInCanvas, moveShapeToCanvasBoundaries } from "./tools/lib";
|
||||||
|
@ -63,6 +63,8 @@ export const setupMaskEditorForEdit = async (
|
||||||
const clozeNote = clozeNoteResponse.value.value;
|
const clozeNote = clozeNoteResponse.value.value;
|
||||||
const canvas = initCanvas();
|
const canvas = initCanvas();
|
||||||
|
|
||||||
|
hideAllGuessOne.set(clozeNote.occludeInactive);
|
||||||
|
|
||||||
// get image width and height
|
// get image width and height
|
||||||
const image = document.getElementById("image") as HTMLImageElement;
|
const image = document.getElementById("image") as HTMLImageElement;
|
||||||
image.src = getImageData(clozeNote.imageData!, clozeNote.imageFileName!);
|
image.src = getImageData(clozeNote.imageData!, clozeNote.imageFileName!);
|
||||||
|
|
Loading…
Reference in a new issue