mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
init: the first public commit for AFFiNE
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import type { TLBounds, TLShape } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
|
||||
/**
|
||||
* Transform a single rectangular shape.
|
||||
* @param shape
|
||||
* @param bounds
|
||||
*/
|
||||
export function transformSingleRectangle<
|
||||
T extends TLShape & { size: number[] }
|
||||
>(shape: T, bounds: TLBounds) {
|
||||
return {
|
||||
size: Vec.toFixed([bounds.width, bounds.height]),
|
||||
point: Vec.toFixed([bounds.minX, bounds.minY]),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user