diff options
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r-- | src/client/views/nodes/ImageBox.tsx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 91e51d24e..ae9e70e8d 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -316,7 +316,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { return cropping; }; - createCanvas = async (downX?: number, downY?: number, cb?: (filename: string, x: number | undefined, y: number | undefined) => void) => { + createCanvas = async () => { const canvas = document.createElement('canvas'); const scaling = 1 / (this._props.NativeDimScaling?.() || 1); const w = AnchorMenu.Instance.marqueeWidth * scaling; @@ -393,9 +393,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { * @param texts */ createBoxes = (boxes: [[[number, number]]], texts: [string]) => { - const nscale = NumCast(this._props.PanelWidth()) * NumCast(this.layoutDoc._freeform_scale, 1); - const nw = nscale / NumCast(this.dataDoc[this.fieldKey + '_nativeWidth']); - for (var i = 0; i < boxes.length; i++) { + for (let i = 0; i < boxes.length; i++) { const coords = boxes[i] ? boxes[i] : []; const width = coords[1][0] - coords[0][0]; const height = coords[2][1] - coords[0][1]; @@ -432,7 +430,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { const response = await gptImageLabel(hrefBase64, 'Make flashcards out of this image with each question and answer labeled as "question" and "answer". Do not label each flashcard and do not include asterisks: '); AnchorMenu.Instance.transferToFlashcard(response, NumCast(this.layoutDoc['x']), NumCast(this.layoutDoc['y'])); } catch (error) { - console.log('Error'); + console.log('Error', error); } this._loading = false; }; @@ -442,7 +440,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { const hrefBase64 = await this.createCanvas(); this.pushInfo(quizMode.NORMAL, hrefBase64); } catch (error) { - console.log('Error'); + console.log('Error', error); } }; @@ -824,7 +822,6 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { }}> <CollectionFreeFormView ref={this._ffref} - // eslint-disable-next-line react/jsx-props-no-spreading {...this._props} setContentViewBox={emptyFunction} NativeWidth={returnZero} |