Skip to content

Commit c6735ed

Browse files
authored
Merge pull request #46 from GeekTree0101/bug/Optimization-VMediaNode
Optimization VMediaNode LayoutSpec
2 parents 1bbba16 + e79c76a commit c6735ed

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

VEditorKit/Classes/VEditorMediaNode.swift

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,20 @@ open class VEditorMediaNode<TargetNode: ASControlNode>: ASCellNode, VEditorMedia
172172
let mediaContentLayout: ASLayoutElement
173173

174174
if isEdit {
175-
mediaContentLayout = ASOverlayLayoutSpec(child: mediaRatioLayout,
176-
overlay: deleteControlNode)
177-
} else {
178-
mediaContentLayout = mediaRatioLayout
179-
}
180-
181-
let videoNodeLayout: ASLayoutElement
182-
183-
if isEdit {
184-
videoNodeLayout =
175+
let deleteableMediaLayout = ASOverlayLayoutSpec(child: mediaRatioLayout,
176+
overlay: deleteControlNode)
177+
mediaContentLayout =
185178
ASStackLayoutSpec(direction: .vertical,
186179
spacing: 0.0,
187180
justifyContent: .start,
188181
alignItems: .stretch,
189182
children: [textInsertionNode,
190-
mediaContentLayout])
183+
deleteableMediaLayout])
191184
} else {
192-
videoNodeLayout = mediaContentLayout
185+
mediaContentLayout = mediaRatioLayout
193186
}
194187

195188
return ASInsetLayoutSpec(insets: insets,
196-
child: videoNodeLayout)
189+
child: mediaContentLayout)
197190
}
198191
}

0 commit comments

Comments
 (0)