bugfix: FDI tooth chart is now compatible with RTL direction.
This commit is contained in:
@@ -24,6 +24,12 @@ const TOOTH_NUMBER_GAP = 'mt-1';
|
|||||||
const REALISTIC_NUMBER_GAP = '2mm';
|
const REALISTIC_NUMBER_GAP = '2mm';
|
||||||
/** Tight interproximal gap between tooth columns. */
|
/** Tight interproximal gap between tooth columns. */
|
||||||
const TOOTH_GAP = 'gap-x-px';
|
const TOOTH_GAP = 'gap-x-px';
|
||||||
|
/**
|
||||||
|
* Centers a mark on the inline-end edge of a tooth column (between this tooth
|
||||||
|
* and the next in flex order). Logical `end` + 0-width flex stays correct in LTR and RTL.
|
||||||
|
*/
|
||||||
|
const EDGE_MARK_ANCHOR =
|
||||||
|
'absolute inset-y-0 end-0 z-10 w-0 flex items-center justify-center';
|
||||||
|
|
||||||
function quadrantMirrored(fdi: FdiToothId): boolean {
|
function quadrantMirrored(fdi: FdiToothId): boolean {
|
||||||
const q = fdi[0];
|
const q = fdi[0];
|
||||||
@@ -285,7 +291,8 @@ export function FdiToothChart({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{renderEdge ? (
|
{renderEdge ? (
|
||||||
linkInteractive ? (
|
<div className={EDGE_MARK_ANCHOR}>
|
||||||
|
{linkInteractive ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
@@ -302,7 +309,7 @@ export function FdiToothChart({
|
|||||||
onToggleLink?.(fdi, next!);
|
onToggleLink?.(fdi, next!);
|
||||||
}}
|
}}
|
||||||
className={`
|
className={`
|
||||||
absolute right-0 z-10 translate-x-1/2 h-3.5 w-3.5 rounded-full border-2 transition-colors
|
h-3.5 w-3.5 shrink-0 rounded-full border-2 transition-colors
|
||||||
focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50
|
focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50
|
||||||
${
|
${
|
||||||
linked
|
linked
|
||||||
@@ -314,11 +321,12 @@ export function FdiToothChart({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
className="absolute right-0 z-10 translate-x-1/2 h-2.5 w-2.5 rounded-full bg-primary shadow-sm"
|
className="h-2.5 w-2.5 shrink-0 rounded-full bg-primary shadow-sm"
|
||||||
title={t('toothConnectedHint')}
|
title={t('toothConnectedHint')}
|
||||||
aria-hidden
|
aria-hidden
|
||||||
/>
|
/>
|
||||||
)
|
)}
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user