|
|
|
@ -124,8 +124,6 @@ const MAX_REFERENCE_IMAGE_BYTES = 10 * 1024 * 1024; |
|
|
|
const COMPOSER_VIEWPORT_MARGIN = 16; |
|
|
|
const COMPOSER_EXPANDED_WIDTH = 640; |
|
|
|
const COMPOSER_COLLAPSED_WIDTH = 560; |
|
|
|
const COMPOSER_EXPANDED_HEIGHT_ESTIMATE = 300; |
|
|
|
const COMPOSER_COLLAPSED_HEIGHT_ESTIMATE = 80; |
|
|
|
const DEFAULT_IMAGE_COUNT_OPTIONS: ImageGenerationCount[] = [1, 2, 4]; |
|
|
|
|
|
|
|
interface SchemaSelectOption { |
|
|
|
@ -1408,16 +1406,10 @@ export function GenerationComposer() { |
|
|
|
); |
|
|
|
const safeZoom = zoom > 0 ? zoom : 1; |
|
|
|
const viewportWidth = typeof window === "undefined" ? Number.POSITIVE_INFINITY : window.innerWidth; |
|
|
|
const viewportHeight = typeof window === "undefined" ? Number.POSITIVE_INFINITY : window.innerHeight; |
|
|
|
const visibleLeft = -viewportX / safeZoom; |
|
|
|
const visibleRight = (viewportWidth - viewportX) / safeZoom; |
|
|
|
const visibleTop = -viewportY / safeZoom; |
|
|
|
const visibleBottom = (viewportHeight - viewportY) / safeZoom; |
|
|
|
const composerWidth = isComposerCollapsed ? COMPOSER_COLLAPSED_WIDTH : COMPOSER_EXPANDED_WIDTH; |
|
|
|
const composerFlowWidth = composerWidth / safeZoom; |
|
|
|
const composerHeightEstimate = isComposerCollapsed |
|
|
|
? COMPOSER_COLLAPSED_HEIGHT_ESTIMATE |
|
|
|
: COMPOSER_EXPANDED_HEIGHT_ESTIMATE; |
|
|
|
const viewportMargin = COMPOSER_VIEWPORT_MARGIN / safeZoom; |
|
|
|
const inlineComposerPosition = context.node && selectedNodeDimensions |
|
|
|
? (() => { |
|
|
|
@ -1428,13 +1420,10 @@ export function GenerationComposer() { |
|
|
|
? Math.min(Math.max(centeredLeft, minLeft), maxLeft) |
|
|
|
: minLeft; |
|
|
|
const belowTop = context.node.position.y + selectedNodeDimensions.height + viewportMargin; |
|
|
|
const aboveTop = context.node.position.y - composerHeightEstimate / safeZoom - viewportMargin; |
|
|
|
const belowFits = belowTop + composerHeightEstimate / safeZoom <= visibleBottom - viewportMargin; |
|
|
|
const aboveFits = aboveTop >= visibleTop + viewportMargin; |
|
|
|
|
|
|
|
return { |
|
|
|
left, |
|
|
|
top: belowFits || !aboveFits ? belowTop : aboveTop, |
|
|
|
top: belowTop, |
|
|
|
}; |
|
|
|
})() |
|
|
|
: null; |
|
|
|
|