@tldraw/editor 3.14.0-canary.f6a0206007b3 → 3.14.0-canary.f8af44c4d1e2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,33 +134,33 @@ export class Box {
134
134
 
135
135
  // eslint-disable-next-line no-restricted-syntax
136
136
  get center() {
137
- return new Vec(this.midX, this.midY)
137
+ return new Vec(this.x + this.w / 2, this.y + this.h / 2)
138
138
  }
139
139
 
140
140
  // eslint-disable-next-line no-restricted-syntax
141
141
  set center(v: Vec) {
142
- this.minX = v.x - this.width / 2
143
- this.minY = v.y - this.height / 2
142
+ this.x = v.x - this.w / 2
143
+ this.y = v.y - this.h / 2
144
144
  }
145
145
 
146
146
  // eslint-disable-next-line no-restricted-syntax
147
147
  get corners() {
148
148
  return [
149
- new Vec(this.minX, this.minY),
150
- new Vec(this.maxX, this.minY),
151
- new Vec(this.maxX, this.maxY),
152
- new Vec(this.minX, this.maxY),
149
+ new Vec(this.x, this.y),
150
+ new Vec(this.x + this.w, this.y),
151
+ new Vec(this.x + this.w, this.y + this.h),
152
+ new Vec(this.x, this.y + this.h),
153
153
  ]
154
154
  }
155
155
 
156
156
  // eslint-disable-next-line no-restricted-syntax
157
157
  get cornersAndCenter() {
158
158
  return [
159
- new Vec(this.minX, this.minY),
160
- new Vec(this.maxX, this.minY),
161
- new Vec(this.maxX, this.maxY),
162
- new Vec(this.minX, this.maxY),
163
- this.center,
159
+ new Vec(this.x, this.y),
160
+ new Vec(this.x + this.w, this.y),
161
+ new Vec(this.x + this.w, this.y + this.h),
162
+ new Vec(this.x, this.y + this.h),
163
+ new Vec(this.x + this.w / 2, this.y + this.h / 2),
164
164
  ]
165
165
  }
166
166
 
@@ -205,10 +205,10 @@ export class Box {
205
205
  }
206
206
 
207
207
  expand(A: Box) {
208
- const minX = Math.min(this.minX, A.minX)
209
- const minY = Math.min(this.minY, A.minY)
210
- const maxX = Math.max(this.maxX, A.maxX)
211
- const maxY = Math.max(this.maxY, A.maxY)
208
+ const minX = Math.min(this.x, A.x)
209
+ const minY = Math.min(this.y, A.y)
210
+ const maxX = Math.max(this.x + this.w, A.x + A.w)
211
+ const maxY = Math.max(this.y + this.h, A.y + A.h)
212
212
 
213
213
  this.x = minX
214
214
  this.y = minY
@@ -245,10 +245,10 @@ export class Box {
245
245
  }
246
246
 
247
247
  snapToGrid(size: number) {
248
- const minX = Math.round(this.minX / size) * size
249
- const minY = Math.round(this.minY / size) * size
250
- const maxX = Math.round(this.maxX / size) * size
251
- const maxY = Math.round(this.maxY / size) * size
248
+ const minX = Math.round(this.x / size) * size
249
+ const minY = Math.round(this.y / size) * size
250
+ const maxX = Math.round((this.x + this.w) / size) * size
251
+ const maxY = Math.round((this.y + this.h) / size) * size
252
252
  this.minX = minX
253
253
  this.minY = minY
254
254
  this.width = Math.max(1, maxX - minX)
@@ -274,26 +274,26 @@ export class Box {
274
274
  getHandlePoint(handle: SelectionCorner | SelectionEdge) {
275
275
  switch (handle) {
276
276
  case 'top_left':
277
- return new Vec(this.minX, this.minY)
277
+ return new Vec(this.x, this.y)
278
278
  case 'top_right':
279
- return new Vec(this.maxX, this.minY)
279
+ return new Vec(this.x + this.w, this.y)
280
280
  case 'bottom_left':
281
- return new Vec(this.minX, this.maxY)
281
+ return new Vec(this.x, this.y + this.h)
282
282
  case 'bottom_right':
283
- return new Vec(this.maxX, this.maxY)
283
+ return new Vec(this.x + this.w, this.y + this.h)
284
284
  case 'top':
285
- return new Vec(this.midX, this.minY)
285
+ return new Vec(this.x + this.w / 2, this.y)
286
286
  case 'right':
287
- return new Vec(this.maxX, this.midY)
287
+ return new Vec(this.x + this.w, this.y + this.h / 2)
288
288
  case 'bottom':
289
- return new Vec(this.midX, this.maxY)
289
+ return new Vec(this.x + this.w / 2, this.y + this.h)
290
290
  case 'left':
291
- return new Vec(this.minX, this.midY)
291
+ return new Vec(this.x, this.y + this.h / 2)
292
292
  }
293
293
  }
294
294
 
295
295
  toJson(): BoxModel {
296
- return { x: this.minX, y: this.minY, w: this.w, h: this.h }
296
+ return { x: this.x, y: this.y, w: this.w, h: this.h }
297
297
  }
298
298
 
299
299
  resize(handle: SelectionCorner | SelectionEdge | string, dx: number, dy: number) {
@@ -357,10 +357,10 @@ export class Box {
357
357
  }
358
358
 
359
359
  union(box: BoxModel) {
360
- const minX = Math.min(this.minX, box.x)
361
- const minY = Math.min(this.minY, box.y)
362
- const maxX = Math.max(this.maxX, box.w + box.x)
363
- const maxY = Math.max(this.maxY, box.h + box.y)
360
+ const minX = Math.min(this.x, box.x)
361
+ const minY = Math.min(this.y, box.y)
362
+ const maxX = Math.max(this.x + this.w, box.x + box.w)
363
+ const maxY = Math.max(this.y + this.h, box.y + box.h)
364
364
 
365
365
  this.x = minX
366
366
  this.y = minY
package/src/version.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '3.14.0-canary.f6a0206007b3'
4
+ export const version = '3.14.0-canary.f8af44c4d1e2'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-06-03T09:18:36.909Z',
8
- patch: '2025-06-03T09:18:36.909Z',
7
+ minor: '2025-06-06T13:42:11.362Z',
8
+ patch: '2025-06-06T13:42:11.362Z',
9
9
  }