('.logseq-tldraw-wrapper .action-bar')
if (canvas) {
canvas.style.height = 'calc(100% - 32px)'
}
- }, [])
+
+ if (actionBar) {
+ actionBar.style.marginBottom = '32px'
+ }
+
+ return () => {
+ if (canvas) {
+ canvas.style.height = '100%'
+ }
+
+ if (actionBar) {
+ actionBar.style.marginBottom = '0px'
+ }
+ }
+ })
return (
{app.selectedTool.id} | {app.selectedTool.currentState.id}
diff --git a/tldraw/apps/tldraw-logseq/src/components/icons/index.ts b/tldraw/apps/tldraw-logseq/src/components/icons/index.ts
index f197b8d22b..acd263cf9c 100644
--- a/tldraw/apps/tldraw-logseq/src/components/icons/index.ts
+++ b/tldraw/apps/tldraw-logseq/src/components/icons/index.ts
@@ -15,4 +15,4 @@ export * from './EraserIcon'
export * from './MultiplayerIcon'
export * from './DiscordIcon'
export * from './LineIcon'
-export * from './LogseqIcon'
\ No newline at end of file
+export * from './LogseqIcon'
diff --git a/tldraw/apps/tldraw-logseq/src/components/inputs/ColorInput.tsx b/tldraw/apps/tldraw-logseq/src/components/inputs/ColorInput.tsx
index 70c694ad06..2bdc7a4652 100644
--- a/tldraw/apps/tldraw-logseq/src/components/inputs/ColorInput.tsx
+++ b/tldraw/apps/tldraw-logseq/src/components/inputs/ColorInput.tsx
@@ -27,7 +27,7 @@ export function ColorInput({ label, value, onChange, ...rest }: ColorInputProps)
name={`color-${label}`}
type="color"
value={computedValue}
- onChange={(e) => {
+ onChange={e => {
setComputedValue(e.target.value)
onChange?.(e)
}}
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx b/tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx
index f4f457f28e..7a346fd13d 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx
@@ -273,7 +273,7 @@ export class TextShape extends TLTextShape {
const {
props: { text, stroke, fontSize, fontFamily },
} = this
- // Stretch to the bound size
+ // Stretch to the bound size
const bounds = this.getBounds()
return (
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/arrow/constants.ts b/tldraw/apps/tldraw-logseq/src/lib/shapes/arrow/constants.ts
index b21f1f13b1..a6c13046b7 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/arrow/constants.ts
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/arrow/constants.ts
@@ -20,25 +20,25 @@ export type Easing =
| 'easeInOutExpo'
export const EASINGS: Record number> = {
- linear: (t) => t,
- easeInQuad: (t) => t * t,
- easeOutQuad: (t) => t * (2 - t),
- easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
- easeInCubic: (t) => t * t * t,
- easeOutCubic: (t) => --t * t * t + 1,
- easeInOutCubic: (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
- easeInQuart: (t) => t * t * t * t,
- easeOutQuart: (t) => 1 - --t * t * t * t,
- easeInOutQuart: (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
- easeInQuint: (t) => t * t * t * t * t,
- easeOutQuint: (t) => 1 + --t * t * t * t * t,
- easeInOutQuint: (t) => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
- easeInSine: (t) => 1 - Math.cos((t * Math.PI) / 2),
- easeOutSine: (t) => Math.sin((t * Math.PI) / 2),
- easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
- easeInExpo: (t) => (t <= 0 ? 0 : Math.pow(2, 10 * t - 10)),
- easeOutExpo: (t) => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t)),
- easeInOutExpo: (t) =>
+ linear: t => t,
+ easeInQuad: t => t * t,
+ easeOutQuad: t => t * (2 - t),
+ easeInOutQuad: t => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
+ easeInCubic: t => t * t * t,
+ easeOutCubic: t => --t * t * t + 1,
+ easeInOutCubic: t => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
+ easeInQuart: t => t * t * t * t,
+ easeOutQuart: t => 1 - --t * t * t * t,
+ easeInOutQuart: t => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
+ easeInQuint: t => t * t * t * t * t,
+ easeOutQuint: t => 1 + --t * t * t * t * t,
+ easeInOutQuint: t => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
+ easeInSine: t => 1 - Math.cos((t * Math.PI) / 2),
+ easeOutSine: t => Math.sin((t * Math.PI) / 2),
+ easeInOutSine: t => -(Math.cos(Math.PI * t) - 1) / 2,
+ easeInExpo: t => (t <= 0 ? 0 : Math.pow(2, 10 * t - 10)),
+ easeOutExpo: t => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t)),
+ easeInOutExpo: t =>
t <= 0
? 0
: t >= 1
@@ -46,4 +46,4 @@ export const EASINGS: Record number> = {
: t < 0.5
? Math.pow(2, 20 * t - 10) / 2
: (2 - Math.pow(2, -20 * t + 10)) / 2,
-}
\ No newline at end of file
+}
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/index.ts b/tldraw/apps/tldraw-logseq/src/lib/shapes/index.ts
index b4f2b43701..32c1d74d81 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/index.ts
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/index.ts
@@ -49,4 +49,4 @@ export const shapes: TLReactShapeConstructor[] = [
TextShape,
YouTubeShape,
LogseqPortalShape,
-]
\ No newline at end of file
+]
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextAreaUtils.ts b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextAreaUtils.ts
index e7de7ba962..98195692dd 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextAreaUtils.ts
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextAreaUtils.ts
@@ -24,7 +24,10 @@ export class TextAreaUtils {
)
}
- /** Inserts `text` at the cursor’s position, replacing any selection, with **undo** support and by firing the `input` event. */
+ /**
+ * Inserts `text` at the cursor’s position, replacing any selection, with **undo** support and by
+ * firing the `input` event.
+ */
static insert(field: HTMLTextAreaElement | HTMLInputElement, text: string): void {
const document = field.ownerDocument
const initialFocus = document.activeElement
@@ -43,7 +46,10 @@ export class TextAreaUtils {
}
}
- /** Replaces the entire content, equivalent to `field.value = text` but with **undo** support and by firing the `input` event. */
+ /**
+ * Replaces the entire content, equivalent to `field.value = text` but with **undo** support and
+ * by firing the `input` event.
+ */
static set(field: HTMLTextAreaElement | HTMLInputElement, text: string): void {
field.select()
TextAreaUtils.insert(field, text)
@@ -58,7 +64,10 @@ export class TextAreaUtils {
)
}
- /** Adds the `wrappingText` before and after field’s selection (or cursor). If `endWrappingText` is provided, it will be used instead of `wrappingText` at on the right. */
+ /**
+ * Adds the `wrappingText` before and after field’s selection (or cursor). If `endWrappingText` is
+ * provided, it will be used instead of `wrappingText` at on the right.
+ */
static wrapSelection(
field: HTMLTextAreaElement | HTMLInputElement,
wrap: string,
@@ -73,7 +82,10 @@ export class TextAreaUtils {
field.selectionEnd = (selectionEnd || 0) + wrap.length
}
- /** Finds and replaces strings and regex in the field’s value, like `field.value = field.value.replace()` but better */
+ /**
+ * Finds and replaces strings and regex in the field’s value, like `field.value =
+ * field.value.replace()` but better
+ */
static replace(
field: HTMLTextAreaElement | HTMLInputElement,
searchValue: string | RegExp,
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextLabel.tsx b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextLabel.tsx
index fc56fe84c3..309175194c 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextLabel.tsx
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/TextLabel.tsx
@@ -183,4 +183,3 @@ export const TextLabel = React.memo(function TextLabel({
)
})
-
diff --git a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/getTextSize.ts b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/getTextSize.ts
index 97da898f5c..b16762a8bb 100644
--- a/tldraw/apps/tldraw-logseq/src/lib/shapes/text/getTextSize.ts
+++ b/tldraw/apps/tldraw-logseq/src/lib/shapes/text/getTextSize.ts
@@ -1,4 +1,4 @@
-import { LETTER_SPACING } from "./constants"
+import { LETTER_SPACING } from './constants'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let melm: any
diff --git a/tldraw/apps/tldraw-logseq/src/styles.css b/tldraw/apps/tldraw-logseq/src/styles.css
index 0415fe2491..188d2b06f2 100644
--- a/tldraw/apps/tldraw-logseq/src/styles.css
+++ b/tldraw/apps/tldraw-logseq/src/styles.css
@@ -54,13 +54,13 @@
font-size: inherit;
}
-
.logseq-tldraw .action-bar {
position: absolute;
- bottom: 31px;
+ bottom: 0;
+
/* width: 100%; */
float: left;
- left: 0px;
+ left: 0;
grid-row: 1;
display: flex;
align-items: center;
@@ -68,6 +68,8 @@
color: black;
border-top-right-radius: 15px;
border: black solid 1px;
+ border-left: none;
+ border-bottom: none;
z-index: 100000;
user-select: none;
background: white;
@@ -87,7 +89,7 @@
background-color: #fff;
border-radius: 6px;
padding: 5px;
- box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
+ box-shadow: 0 10px 38px -10px rgba(22, 23, 24, 0.35), 0 10px 20px -15px rgba(22, 23, 24, 0.2);
}
.dropdown-item {
@@ -100,10 +102,11 @@
display: flex;
align-items: center;
height: 25px;
- padding: 0px 5px;
+ padding: 0 5px;
position: relative;
user-select: none;
}
+
.dropdown-item:focus {
color: white;
background-color: black;
@@ -115,7 +118,7 @@
color: black;
}
-.right-slot:focus{
+.right-slot:focus {
color: whites;
}
@@ -258,7 +261,7 @@
gap: 8px;
}
-.logseq-tldraw .floating-panel>button {
+.logseq-tldraw .floating-panel > button {
border-radius: 4px;
}
@@ -286,7 +289,7 @@
color: var(--color-selectedContrast);
}
-.logseq-tldraw .floating-panel[data-tool-locked='true']>.button[data-selected='true']::after {
+.logseq-tldraw .floating-panel[data-tool-locked='true'] > .button[data-selected='true']::after {
content: '';
display: block;
height: 6px;
@@ -458,6 +461,7 @@
.logseq-tldraw .preview-minimap {
height: 300px;
width: 400px;
+
/* Set top to be the viewport minus 10px */
bottom: calc(100vh - 320px);
@@ -605,4 +609,4 @@ html[data-theme='light'] .logseq-tldraw .tl-logseq-portal-header {
html[data-theme='dark'] .logseq-tldraw .tl-logseq-portal-header {
backdrop-filter: brightness(1.2);
-}
\ No newline at end of file
+}
diff --git a/tldraw/apps/tldraw-logseq/tsconfig.json b/tldraw/apps/tldraw-logseq/tsconfig.json
index 41e3b03988..b5118c6898 100644
--- a/tldraw/apps/tldraw-logseq/tsconfig.json
+++ b/tldraw/apps/tldraw-logseq/tsconfig.json
@@ -7,7 +7,7 @@
"baseUrl": ".",
"paths": {
"~*": ["src/*"]
- },
+ }
},
"references": [
{ "path": "../../packages/core" },
diff --git a/tldraw/apps/tldraw-logseq/tsup.config.ts b/tldraw/apps/tldraw-logseq/tsup.config.ts
index 035e95d594..06a2b08dc6 100644
--- a/tldraw/apps/tldraw-logseq/tsup.config.ts
+++ b/tldraw/apps/tldraw-logseq/tsup.config.ts
@@ -10,6 +10,6 @@ export default defineConfig({
'.png': 'base64',
},
env: {
- NODE_ENV: 'production'
- }
+ NODE_ENV: 'production',
+ },
})
diff --git a/tldraw/cljs-demo/public/index.html b/tldraw/cljs-demo/public/index.html
index d342958283..58e17bb56f 100644
--- a/tldraw/cljs-demo/public/index.html
+++ b/tldraw/cljs-demo/public/index.html
@@ -8,7 +8,7 @@
/>
-
+
diff --git a/tldraw/demo/src/index.css b/tldraw/demo/src/index.css
index a90f0749c7..b5c61c9567 100644
--- a/tldraw/demo/src/index.css
+++ b/tldraw/demo/src/index.css
@@ -1,4 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
-
diff --git a/tldraw/demo/tailwind.config.js b/tldraw/demo/tailwind.config.js
index e0ac62b722..7cd69b050f 100644
--- a/tldraw/demo/tailwind.config.js
+++ b/tldraw/demo/tailwind.config.js
@@ -1,5 +1,5 @@
module.exports = {
- // just import everything for ease of dev
+ // just import everything for ease of dev
safelist: [{ pattern: /.*/ }],
theme: {
extend: {},
diff --git a/tldraw/demo/vite.config.js b/tldraw/demo/vite.config.js
index 53debc0fbc..f252bc9ee8 100644
--- a/tldraw/demo/vite.config.js
+++ b/tldraw/demo/vite.config.js
@@ -23,8 +23,8 @@ export default defineConfig({
server: {
port: '3031',
fs: {
- strict: false
- }
+ strict: false,
+ },
},
resolve: {
alias: [
diff --git a/tldraw/packages/core/src/lib/TLApi/TLApi.ts b/tldraw/packages/core/src/lib/TLApi/TLApi.ts
index e6977ccc04..69ed753d61 100644
--- a/tldraw/packages/core/src/lib/TLApi/TLApi.ts
+++ b/tldraw/packages/core/src/lib/TLApi/TLApi.ts
@@ -141,7 +141,7 @@ export class TLApi ex
}
static id = 'box'
-
+
canBind = true
static defaultProps: TLBoxShapeProps = {
diff --git a/tldraw/packages/core/src/lib/tools/TLSelectTool/states/ResizingState.ts b/tldraw/packages/core/src/lib/tools/TLSelectTool/states/ResizingState.ts
index 142d72803f..e520453bcd 100644
--- a/tldraw/packages/core/src/lib/tools/TLSelectTool/states/ResizingState.ts
+++ b/tldraw/packages/core/src/lib/tools/TLSelectTool/states/ResizingState.ts
@@ -66,29 +66,28 @@ export class ResizingState<
this.initialCommonBounds = { ...selectionBounds }
// @ts-expect-error maybe later
this.snapshots = Object.fromEntries(
- selectedShapesArray
- .map(shape => {
- const bounds = { ...shape.bounds }
- const [cx, cy] = BoundsUtils.getBoundsCenter(bounds)
- return [
- shape.id,
- {
- props: shape.serialized,
- bounds,
- transformOrigin: [
- (cx - this.initialCommonBounds.minX) / this.initialCommonBounds.width,
- (cy - this.initialCommonBounds.minY) / this.initialCommonBounds.height,
- ],
- innerTransformOrigin: [
- (cx - initialInnerBounds.minX) / initialInnerBounds.width,
- (cy - initialInnerBounds.minY) / initialInnerBounds.height,
- ],
- isAspectRatioLocked:
- shape.props.isAspectRatioLocked ||
- Boolean(!shape.canChangeAspectRatio || shape.props.rotation),
- },
- ]
- })
+ selectedShapesArray.map(shape => {
+ const bounds = { ...shape.bounds }
+ const [cx, cy] = BoundsUtils.getBoundsCenter(bounds)
+ return [
+ shape.id,
+ {
+ props: shape.serialized,
+ bounds,
+ transformOrigin: [
+ (cx - this.initialCommonBounds.minX) / this.initialCommonBounds.width,
+ (cy - this.initialCommonBounds.minY) / this.initialCommonBounds.height,
+ ],
+ innerTransformOrigin: [
+ (cx - initialInnerBounds.minX) / initialInnerBounds.width,
+ (cy - initialInnerBounds.minY) / initialInnerBounds.height,
+ ],
+ isAspectRatioLocked:
+ shape.props.isAspectRatioLocked ||
+ Boolean(!shape.canChangeAspectRatio || shape.props.rotation),
+ },
+ ]
+ })
)
selectedShapesArray.forEach(shape => shape.onResizeStart?.({ isSingle: this.isSingle }))
}
diff --git a/tldraw/packages/core/src/types/types.ts b/tldraw/packages/core/src/types/types.ts
index 485b43ebce..eb443dfad3 100644
--- a/tldraw/packages/core/src/types/types.ts
+++ b/tldraw/packages/core/src/types/types.ts
@@ -168,7 +168,7 @@ export type TLSubscriptionEvent =
event: 'delete-assets'
info: { assets: TLAsset[] }
}
- | {
+ | {
event: 'canvas-dbclick'
info: { point: number[] }
}
diff --git a/tldraw/packages/core/src/utils/PolygonUtils.ts b/tldraw/packages/core/src/utils/PolygonUtils.ts
index 693d235d3b..c08bb2f15c 100644
--- a/tldraw/packages/core/src/utils/PolygonUtils.ts
+++ b/tldraw/packages/core/src/utils/PolygonUtils.ts
@@ -106,8 +106,8 @@ export class PolygonUtils {
}
static getPolygonCentroid(points: number[][]): number[] {
- const x = points.map((point) => point[0])
- const y = points.map((point) => point[1])
+ const x = points.map(point => point[0])
+ const y = points.map(point => point[1])
const cx = Math.min(...x) + Math.max(...x)
const cy = Math.min(...y) + Math.max(...y)
return [cx ? cx / 2 : 0, cy ? cy / 2 : 0]
diff --git a/tldraw/packages/core/src/utils/index.ts b/tldraw/packages/core/src/utils/index.ts
index 9eaeaec145..6ba9d2d91a 100644
--- a/tldraw/packages/core/src/utils/index.ts
+++ b/tldraw/packages/core/src/utils/index.ts
@@ -62,4 +62,3 @@ export function isDarwin(): boolean {
export function modKey(e: any): boolean {
return isDarwin() ? e.metaKey : e.ctrlKey
}
-
diff --git a/tldraw/packages/react/src/components/ui/SelectionForeground/handles/EdgeHandle.tsx b/tldraw/packages/react/src/components/ui/SelectionForeground/handles/EdgeHandle.tsx
index f3b4951308..fd9ef8a056 100644
--- a/tldraw/packages/react/src/components/ui/SelectionForeground/handles/EdgeHandle.tsx
+++ b/tldraw/packages/react/src/components/ui/SelectionForeground/handles/EdgeHandle.tsx
@@ -35,7 +35,7 @@ export const EdgeHandle = observer(function EdgeHandle({
return (
{
+ document.addEventListener('paste', e => {
e.preventDefault()
app.paste(e)
})
- document.addEventListener('copy', (e) => {
+ document.addEventListener('copy', e => {
e.preventDefault()
app.copy()
})
diff --git a/tldraw/packages/react/src/hooks/useMinimapEvents.ts b/tldraw/packages/react/src/hooks/useMinimapEvents.ts
index 5f9cd3019c..941f806f35 100644
--- a/tldraw/packages/react/src/hooks/useMinimapEvents.ts
+++ b/tldraw/packages/react/src/hooks/useMinimapEvents.ts
@@ -46,4 +46,4 @@ export function useMinimapEvents() {
}, [callbacks])
return events
-}
\ No newline at end of file
+}
diff --git a/tldraw/packages/react/src/hooks/useSetup.ts b/tldraw/packages/react/src/hooks/useSetup.ts
index c739160e43..2ae1f22aab 100644
--- a/tldraw/packages/react/src/hooks/useSetup.ts
+++ b/tldraw/packages/react/src/hooks/useSetup.ts
@@ -20,7 +20,7 @@ export function useSetup<
onDeleteShapes,
onFileDrop,
onPaste,
- onCanvasDBClick
+ onCanvasDBClick,
} = props
React.useLayoutEffect(() => {
diff --git a/tldraw/packages/react/src/lib/TLReactApp.ts b/tldraw/packages/react/src/lib/TLReactApp.ts
index c43ee1c50a..62b61dd918 100644
--- a/tldraw/packages/react/src/lib/TLReactApp.ts
+++ b/tldraw/packages/react/src/lib/TLReactApp.ts
@@ -3,5 +3,5 @@ import type { TLReactShape } from './TLReactShape'
import type { TLReactEventMap } from '~types'
export class TLReactApp extends TLApp {
- pubEvent?: any
+ pubEvent?: any
}
diff --git a/tldraw/packages/utils/curve/package.json b/tldraw/packages/utils/curve/package.json
index a73bc013ca..51d24d71ba 100644
--- a/tldraw/packages/utils/curve/package.json
+++ b/tldraw/packages/utils/curve/package.json
@@ -35,4 +35,4 @@
"clean": "rm -rf dist"
},
"gitHead": "3ab5db27b9e83736fdae934474e80e90c854922c"
-}
\ No newline at end of file
+}
diff --git a/tldraw/packages/utils/intersect/package.json b/tldraw/packages/utils/intersect/package.json
index 3d50d03013..f230a07550 100644
--- a/tldraw/packages/utils/intersect/package.json
+++ b/tldraw/packages/utils/intersect/package.json
@@ -37,4 +37,4 @@
"@tldraw/vec": "2.0.0-alpha.1"
},
"gitHead": "3ab5db27b9e83736fdae934474e80e90c854922c"
-}
\ No newline at end of file
+}
diff --git a/tldraw/packages/utils/intersect/src/index.ts b/tldraw/packages/utils/intersect/src/index.ts
index 60bf48888e..770a918685 100644
--- a/tldraw/packages/utils/intersect/src/index.ts
+++ b/tldraw/packages/utils/intersect/src/index.ts
@@ -18,6 +18,7 @@ export interface TLBounds {
/**
* Get an intersection.
+ *
* @param message
* @param points
* @internal
@@ -28,7 +29,6 @@ function createIntersection(message: string, ...points: number[][]): TLIntersect
}
/**
- *
* @param point
* @param size
* @param rotation
@@ -51,6 +51,7 @@ function getRectangleSides(point: number[], size: number[], rotation = 0): [stri
/**
* Get whether angle c lies between angles a and b.
+ *
* @param a
* @param b
* @param c
@@ -94,6 +95,7 @@ export function intersectLineLine(AB: number[][], PQ: number[][]): number[] | un
/**
* Find the intersection between a ray and a ray.
+ *
* @param p0 The first ray's point
* @param n0 The first ray's direction vector.
* @param p1 The second ray's point.
@@ -126,6 +128,7 @@ export function intersectRayRay(
/**
* Find the intersections between a ray and a line segment.
+ *
* @param origin
* @param direction
* @param a1
@@ -157,6 +160,7 @@ export function intersectRayLineSegment(
/**
* Find the intersections between a ray and a rectangle.
+ *
* @param origin
* @param direction
* @param point
@@ -175,6 +179,7 @@ export function intersectRayRectangle(
/**
* Find the intersections between a ray and an ellipse.
+ *
* @param origin
* @param direction
* @param center
@@ -197,6 +202,7 @@ export function intersectRayEllipse(
/**
* Find the intersections between a ray and a bounding box.
+ *
* @param origin
* @param direction
* @param bounds
@@ -218,6 +224,7 @@ export function intersectRayBounds(
/**
* Find the intersection between a line segment and a ray.
+ *
* @param a1
* @param a2
* @param origin
@@ -234,6 +241,7 @@ export function intersectLineSegmentRay(
/**
* Find the intersection between a line segment and a line segment.
+ *
* @param a1
* @param a2
* @param b1
@@ -274,6 +282,7 @@ export function intersectLineSegmentLineSegment(
/**
* Find the intersections between a line segment and a rectangle.
+ *
* @param a1
* @param a2
* @param point
@@ -290,6 +299,7 @@ export function intersectLineSegmentRectangle(
/**
* Find the intersections between a line segment and an arc.
+ *
* @param a1
* @param a2
* @param center
@@ -311,7 +321,7 @@ export function intersectLineSegmentArc(
if (!ellipseTest.didIntersect) return createIntersection('no intersection')
- const points = ellipseTest.points.filter((point) =>
+ const points = ellipseTest.points.filter(point =>
isAngleBetween(sa, ea, Vec.angle(center, point))
)
@@ -324,6 +334,7 @@ export function intersectLineSegmentArc(
/**
* Find the intersections between a line segment and a circle.
+ *
* @param a1
* @param a2
* @param c
@@ -375,6 +386,7 @@ export function intersectLineSegmentCircle(
/**
* Find the intersections between a line segment and an ellipse.
+ *
* @param a1
* @param a2
* @param center
@@ -429,15 +441,16 @@ export function intersectLineSegmentEllipse(
// Filter to only points that are on the segment.
// Solve for points, then counter-rotate points.
const points = tValues
- .filter((t) => t >= 0 && t <= 1)
- .map((t) => Vec.add(center, Vec.add(a1, Vec.mul(Vec.sub(a2, a1), t))))
- .map((p) => Vec.rotWith(p, center, rotation))
+ .filter(t => t >= 0 && t <= 1)
+ .map(t => Vec.add(center, Vec.add(a1, Vec.mul(Vec.sub(a2, a1), t))))
+ .map(p => Vec.rotWith(p, center, rotation))
return createIntersection('intersection', ...points)
}
/**
* Find the intersections between a line segment and a bounding box.
+ *
* @param a1
* @param a2
* @param bounds
@@ -452,6 +465,7 @@ export function intersectLineSegmentBounds(
/**
* Find the intersections between a line segment and a polyline.
+ *
* @param a1
* @param a2
* @param points
@@ -479,6 +493,7 @@ export function intersectLineSegmentPolyline(
}
/**
* Find the intersections between a line segment and a closed polygon.
+ *
* @param a1
* @param a2
* @param points
@@ -511,6 +526,7 @@ export function intersectLineSegmentPolygon(
/**
* Find the intersections between a rectangle and a ray.
+ *
* @param point
* @param size
* @param rotation
@@ -537,11 +553,12 @@ export function intersectRectangleRay(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and a line segment.
+ *
* @param point
* @param size
* @param a1
@@ -566,11 +583,12 @@ export function intersectRectangleLineSegment(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and a rectangle.
+ *
* @param point1
* @param size1
* @param point2
@@ -587,9 +605,7 @@ export function intersectRectangleRectangle(
const intersections = intersectRectangleLineSegment(point2, size2, a1, a2)
acc.push(
- ...intersections.map((int) =>
- createIntersection(`${message} ${int.message}`, ...int.points)
- )
+ ...intersections.map(int => createIntersection(`${message} ${int.message}`, ...int.points))
)
return acc
@@ -597,11 +613,12 @@ export function intersectRectangleRectangle(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and an arc.
+ *
* @param point
* @param size
* @param center
@@ -630,11 +647,12 @@ export function intersectRectangleArc(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and a circle.
+ *
* @param point
* @param size
* @param c
@@ -659,11 +677,12 @@ export function intersectRectangleCircle(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and an ellipse.
+ *
* @param point
* @param size
* @param c
@@ -692,11 +711,12 @@ export function intersectRectangleEllipse(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and a bounding box.
+ *
* @param point
* @param size
* @param bounds
@@ -712,6 +732,7 @@ export function intersectRectangleBounds(
/**
* Find the intersections between a rectangle and a polyline.
+ *
* @param point
* @param size
* @param points
@@ -734,10 +755,11 @@ export function intersectRectanglePolyline(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/**
* Find the intersections between a rectangle and a polygon.
+ *
* @param point
* @param size
* @param points
@@ -760,7 +782,7 @@ export function intersectRectanglePolygon(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
/* -------------------------------------------------- */
@@ -769,6 +791,7 @@ export function intersectRectanglePolygon(
/**
* Find the intersections between a arc and a line segment.
+ *
* @param center
* @param radius
* @param start
@@ -789,6 +812,7 @@ export function intersectArcLineSegment(
/**
* Find the intersections between a arc and a rectangle.
+ *
* @param center
* @param radius
* @param start
@@ -809,6 +833,7 @@ export function intersectArcRectangle(
/**
* Find the intersections between a arc and a bounding box.
+ *
* @param center
* @param radius
* @param start
@@ -832,6 +857,7 @@ export function intersectArcBounds(
/**
* Find the intersections between a circle and a line segment.
+ *
* @param c
* @param r
* @param a1
@@ -848,6 +874,7 @@ export function intersectCircleLineSegment(
/**
* Find the intersections between a circle and a circle.
+ *
* @param c1
* @param r1
* @param c2
@@ -878,6 +905,7 @@ export function intersectCircleCircle(
/**
* Find the intersections between a circle and a rectangle.
+ *
* @param c
* @param r
* @param point
@@ -894,6 +922,7 @@ export function intersectCircleRectangle(
/**
* Find the intersections between a circle and a bounding box.
+ *
* @param c
* @param r
* @param bounds
@@ -909,6 +938,7 @@ export function intersectCircleBounds(c: number[], r: number, bounds: TLBounds):
/**
* Find the intersections between an ellipse and a ray.
+ *
* @param center
* @param rx
* @param ry
@@ -929,6 +959,7 @@ export function intersectEllipseRay(
/**
* Find the intersections between an ellipse and a line segment.
+ *
* @param center
* @param rx
* @param ry
@@ -953,6 +984,7 @@ export function intersectEllipseLineSegment(
/**
* Find the intersections between an ellipse and a rectangle.
+ *
* @param center
* @param rx
* @param ry
@@ -976,8 +1008,9 @@ export function intersectEllipseRectangle(
}
/**
- * Find the intersections between an ellipse and an ellipse.
- * Adapted from https://gist.github.com/drawable/92792f59b6ff8869d8b1
+ * Find the intersections between an ellipse and an ellipse. Adapted from
+ * https://gist.github.com/drawable/92792f59b6ff8869d8b1
+ *
* @param _c1
* @param _rx1
* @param _ry1
@@ -1011,6 +1044,7 @@ export function intersectEllipseEllipse(
/**
* Find the intersections between an ellipse and a circle.
+ *
* @param c
* @param rx
* @param ry
@@ -1031,6 +1065,7 @@ export function intersectEllipseCircle(
/**
* Find the intersections between an ellipse and a bounding box.
+ *
* @param c
* @param rx
* @param ry
@@ -1050,6 +1085,7 @@ export function intersectEllipseBounds(
/**
* Find the intersections between a bounding box and a ray.
+ *
* @param bounds
* @param origin
* @param direction
@@ -1065,6 +1101,7 @@ export function intersectBoundsRay(
/**
* Find the intersections between a bounding box and a line segment.
+ *
* @param bounds
* @param a1
* @param a2
@@ -1080,6 +1117,7 @@ export function intersectBoundsLineSegment(
/**
* Find the intersections between a bounding box and a rectangle.
+ *
* @param bounds
* @param point
* @param size
@@ -1095,6 +1133,7 @@ export function intersectBoundsRectangle(
/**
* Find the intersections between a bounding box and a bounding box.
+ *
* @param bounds1
* @param bounds2
*/
@@ -1109,6 +1148,7 @@ export function intersectBoundsBounds(bounds1: TLBounds, bounds2: TLBounds): TLI
/**
* Find the intersections between a bounding box and an arc.
+ *
* @param bounds
* @param center
* @param radius
@@ -1128,6 +1168,7 @@ export function intersectBoundsArc(
/**
* Find the intersections between a bounding box and a circle.
+ *
* @param bounds
* @param c
* @param r
@@ -1139,6 +1180,7 @@ export function intersectBoundsCircle(bounds: TLBounds, c: number[], r: number):
/**
* Find the intersections between a bounding box and an ellipse.
+ *
* @param bounds
* @param c
* @param rx
@@ -1158,6 +1200,7 @@ export function intersectBoundsEllipse(
/**
* Find the intersections between a bounding box and a polyline.
+ *
* @param bounds
* @param points
*/
@@ -1167,6 +1210,7 @@ export function intersectBoundsPolyline(bounds: TLBounds, points: number[][]): T
/**
* Find the intersections between a bounding box and a polygon.
+ *
* @param bounds
* @param points
*/
@@ -1180,6 +1224,7 @@ export function intersectBoundsPolygon(bounds: TLBounds, points: number[][]): TL
/**
* Find the intersections between a polyline and a line segment.
+ *
* @param points
* @param a1
* @param a2
@@ -1194,6 +1239,7 @@ export function intersectPolylineLineSegment(
/**
* Find the intersections between a polyline and a rectangle.
+ *
* @param points
* @param point
* @param size
@@ -1208,6 +1254,7 @@ export function intersectPolylineRectangle(
/**
* Find the intersections between a polyline and a bounding box.
+ *
* @param points
* @param bounds
*/
@@ -1225,6 +1272,7 @@ export function intersectPolylineBounds(points: number[][], bounds: TLBounds): T
/**
* Find the intersections between a polygon nd a line segment.
+ *
* @param points
* @param a1
* @param a2
@@ -1239,6 +1287,7 @@ export function intersectPolygonLineSegment(
/**
* Find the intersections between a polygon and a rectangle.
+ *
* @param points
* @param point
* @param size
@@ -1253,6 +1302,7 @@ export function intersectPolygonRectangle(
/**
* Find the intersections between a polygon and a bounding box.
+ *
* @param points
* @param bounds
*/
@@ -1266,6 +1316,7 @@ export function intersectPolygonBounds(points: number[][], bounds: TLBounds): TL
/**
* Find the intersections between a rectangle and a ray.
+ *
* @param point
* @param size
* @param rotation
@@ -1290,7 +1341,7 @@ export function intersectRayPolygon(
[]
)
- return sideIntersections.filter((int) => int.didIntersect)
+ return sideIntersections.filter(int => int.didIntersect)
}
export function pointsToLineSegments(points: number[][], closed = false) {
diff --git a/tldraw/packages/utils/vec/package.json b/tldraw/packages/utils/vec/package.json
index ece7e725ec..c1339dd4cb 100644
--- a/tldraw/packages/utils/vec/package.json
+++ b/tldraw/packages/utils/vec/package.json
@@ -33,4 +33,4 @@
"clean": "rm -rf dist"
},
"gitHead": "3ab5db27b9e83736fdae934474e80e90c854922c"
-}
\ No newline at end of file
+}