nehan
Version:
Html layout engine for paged-media written in Typescript
39 lines • 1.07 kB
JavaScript
import { LogicalPos, } from "./public-api";
export class LogicalCursorPos {
constructor(value) {
this.start = value.start;
this.before = value.before;
}
static get zero() {
return new LogicalCursorPos(this.zeroValue);
}
static get zeroValue() {
return { start: 0, before: 0 };
}
zero() {
this.start = 0;
this.before = 0;
}
clone() {
return new LogicalCursorPos({ start: this.start, before: this.before });
}
cloneValue() {
return { start: this.start, before: this.before };
}
get logicalPos() {
return new LogicalPos({ before: this.before, start: this.start });
}
toString() {
return `(${this.start}, ${this.before})`;
}
translate(offset) {
return new LogicalCursorPos({
before: this.before + offset.before,
start: this.start + offset.start
});
}
acceptCssEvaluator(visitor) {
return visitor.visitPos(this);
}
}
//# sourceMappingURL=logical-cursor-pos.js.map