-const getRtlAdapter = function(rectX, width) {
+const getRightToLeftAdapter = function(rectX, width) {
return {
x(x) {
return rectX + rectX + width - x;
};
};
-const getLtrAdapter = function() {
+const getLeftToRightAdapter = function() {
return {
x(x) {
return x;
};
};
-const getAdapter = function(rtl, rectX, width) {
- return rtl ? getRtlAdapter(rectX, width) : getLtrAdapter();
-};
+export function getRtlAdapter(rtl, rectX, width) {
+ return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();
+}
-const overrideTextDirection = function(ctx, direction) {
+export function overrideTextDirection(ctx, direction) {
let style, original;
if (direction === 'ltr' || direction === 'rtl') {
style = ctx.canvas.style;
style.setProperty('direction', direction, 'important');
ctx.prevTextDirection = original;
}
-};
+}
-const restoreTextDirection = function(ctx, original) {
+export function restoreTextDirection(ctx, original) {
if (original !== undefined) {
delete ctx.prevTextDirection;
ctx.canvas.style.setProperty('direction', original[0], original[1]);
}
-};
-
-export {
- getAdapter as getRtlAdapter,
- overrideTextDirection,
- restoreTextDirection
-};
+}