fix: build issue

This commit is contained in:
Peng Xiao
2022-08-22 13:51:51 +08:00
parent ddb794907d
commit 4bd023abd3
4 changed files with 10 additions and 5 deletions

View File

@@ -61,10 +61,11 @@ export class HTMLShape extends TLBoxShape<HTMLShapeProps> {
onResetBounds = (info?: TLResetBoundsInfo) => {
if (this.htmlAnchorRef.current) {
const rect = this.htmlAnchorRef.current.getBoundingClientRect()
this.update({
size: [
this.props.size[0],
Math.max(Math.min(this.htmlAnchorRef.current.offsetHeight || 400, 800), 10),
Math.max(Math.min(rect.width || 400, 800), 10),
Math.max(Math.min(rect.height || 400, 800), 10),
],
})
}

View File

@@ -642,6 +642,10 @@ button.tl-select-input-trigger {
transform-origin: top left;
}
.tl-html-anchor {
width: fit-content;
}
.tl-html-anchor > iframe {
@apply h-full w-full !important;
margin: 0;

View File

@@ -38,7 +38,7 @@ export class TLImageShape<
assetId: '',
}
autoResize = (info: TLResetBoundsInfo<TLImageAsset>) => {
onResetBounds: (info?: TLResetBoundsInfo | undefined) => this = (info: any) => {
const { clipping, size, point } = this.props
if (clipping) {
const [t, r, b, l] = Array.isArray(clipping)

View File

@@ -77,7 +77,7 @@ export class HoveringSelectionHandleState<
break
}
case TLTargetType.Selection: {
selectedShape.autoResize?.({})
selectedShape.onResetBounds?.({})
if (this.app.selectedShapesArray.length === 1) {
this.tool.transition('editingShape', {
type: TLTargetType.Shape,
@@ -91,7 +91,7 @@ export class HoveringSelectionHandleState<
const asset = selectedShape.props.assetId
? this.app.assets[selectedShape.props.assetId]
: undefined
selectedShape.autoResize({ asset })
selectedShape.onResetBounds({ asset })
this.tool.transition('idle')
}
}