aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/Doc.ts16
-rw-r--r--src/fields/List.ts5
2 files changed, 10 insertions, 11 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 9e3eb28f9..feacdc9c5 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -687,16 +687,12 @@ export namespace Doc {
*/
export function ComputeContentBounds(docList: Doc[]) {
const bounds = docList.reduce(
- (bounds, doc) => {
- const [sptX, sptY] = [NumCast(doc.x), NumCast(doc.y)];
- const [bptX, bptY] = [sptX + doc[Width](), sptY + doc[Height]()];
- return {
- x: Math.min(sptX, bounds.x),
- y: Math.min(sptY, bounds.y),
- r: Math.max(bptX, bounds.r),
- b: Math.max(bptY, bounds.b),
- };
- },
+ (bounds, doc) => ({
+ x: Math.min(NumCast(doc.x), bounds.x),
+ y: Math.min(NumCast(doc.y), bounds.y),
+ r: Math.max(NumCast(doc.x) + doc[Width](), bounds.r),
+ b: Math.max(NumCast(doc.y) + doc[Height](), bounds.b),
+ }),
{ x: Number.MAX_VALUE, y: Number.MAX_VALUE, r: -Number.MAX_VALUE, b: -Number.MAX_VALUE }
);
return bounds;
diff --git a/src/fields/List.ts b/src/fields/List.ts
index f3fcc87f7..da007e972 100644
--- a/src/fields/List.ts
+++ b/src/fields/List.ts
@@ -236,7 +236,10 @@ class ListImpl<T extends Field> extends ObjectField {
const list = new Proxy<this>(this, {
set: setter,
get: ListImpl.listGetter,
- ownKeys: target => Object.keys(target.__fieldTuples),
+ ownKeys: target => {
+ const keys = Object.keys(target.__fieldTuples);
+ return [...keys, '__realFields'];
+ },
getOwnPropertyDescriptor: (target, prop) => {
if (prop in target[FieldTuples]) {
return {