Skip to content

Commit

Permalink
fix: fixed #2543
Browse files Browse the repository at this point in the history
  • Loading branch information
arnog committed Nov 11, 2024
1 parent 6f33006 commit 256b09b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 357 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- **#2540** When using `renderMathInElement()` some white space was occasionally
incorrectly removed.
- **#2545** (?) Use `\rightarrow` instead of `\rarr` in the virtual keyboard.
- **#2543** The `MathfieldElement.fractionNavigationOrder` was not respected
when navigating in a fraction with the arrow keys.

## 0.101.1 _2024-10-15_

Expand Down
10 changes: 2 additions & 8 deletions src/atoms/genfrac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { makeCustomSizedDelim, makeNullDelimiter } from '../core/delimiters';
import { Context } from '../core/context';
import { AXIS_HEIGHT } from '../core/font-metrics';
import type { AtomJson } from 'core/types';
import { MathfieldElement } from 'public/mathlive';

export type GenfracOptions = {
continuousFraction?: boolean;
Expand All @@ -17,7 +18,6 @@ export type GenfracOptions = {
rightDelim?: string;
hasBarLine?: boolean;
mathstyleName?: MathstyleName;
fractionNavigationOrder?: 'numerator-denominator' | 'denominator-numerator';
style?: Style;
};

Expand All @@ -41,9 +41,6 @@ export class GenfracAtom extends Atom {
private readonly numerPrefix?: string;
private readonly denomPrefix?: string;
private readonly mathstyleName?: MathstyleName;
private readonly fractionNavigationOrder?:
| 'numerator-denominator'
| 'denominator-numerator';

constructor(
above: Readonly<Atom[]>,
Expand All @@ -65,7 +62,6 @@ export class GenfracAtom extends Atom {
this.mathstyleName = options?.mathstyleName;
this.leftDelim = options?.leftDelim;
this.rightDelim = options?.rightDelim;
this.fractionNavigationOrder = options?.fractionNavigationOrder;
}

static fromJson(json: AtomJson): GenfracAtom {
Expand All @@ -86,8 +82,6 @@ export class GenfracAtom extends Atom {
if (this.rightDelim) options.rightDelim = this.rightDelim;
if (!this.hasBarLine) options.hasBarLine = false;
if (this.mathstyleName) options.mathstyleName = this.mathstyleName;
if (this.fractionNavigationOrder)
options.fractionNavigationOrder = this.fractionNavigationOrder;
return { ...super.toJson(), ...options };
}

Expand All @@ -97,7 +91,7 @@ export class GenfracAtom extends Atom {
if (this._children) return this._children;

const result: Atom[] = [];
if (this.fractionNavigationOrder === 'denominator-numerator') {
if (MathfieldElement.fractionNavigationOrder === 'denominator-numerator') {
for (const x of this.below!) {
result.push(...x.children);
result.push(x);
Expand Down
Loading

0 comments on commit 256b09b

Please sign in to comment.