first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
use galaxyui::{
|
||||
AppContext, Element, SizeConstraint,
|
||||
elements::{Border, CornerRadius, Empty, Radius},
|
||||
geometry::vector::vec2f,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
editor::RunnableCommandModel,
|
||||
extract_block,
|
||||
render::{
|
||||
BLOCK_FOOTER_HEIGHT,
|
||||
model::{BlockItem, RenderState, viewport::ViewportItem},
|
||||
},
|
||||
};
|
||||
use galaxyui_core::elements::{Border, CornerRadius, Empty, Radius};
|
||||
use galaxyui_core::geometry::vector::vec2f;
|
||||
use galaxyui_core::{AppContext, Element, SizeConstraint};
|
||||
|
||||
use super::{RenderContext, RenderableBlock};
|
||||
use crate::editor::RunnableCommandModel;
|
||||
use crate::extract_block;
|
||||
use crate::render::BLOCK_FOOTER_HEIGHT;
|
||||
use crate::render::model::viewport::ViewportItem;
|
||||
use crate::render::model::{BlockItem, RenderState};
|
||||
|
||||
/// [`RenderableBlock`] implementation for runnable command blocks.
|
||||
pub struct RenderableRunnableCommand {
|
||||
@@ -51,7 +45,7 @@ impl RenderableBlock for RenderableRunnableCommand {
|
||||
fn layout(
|
||||
&mut self,
|
||||
_model: &RenderState,
|
||||
ctx: &mut galaxyui::LayoutContext,
|
||||
ctx: &mut galaxyui_core::LayoutContext,
|
||||
app: &AppContext,
|
||||
) {
|
||||
self.footer.layout(
|
||||
@@ -66,7 +60,7 @@ impl RenderableBlock for RenderableRunnableCommand {
|
||||
|
||||
fn paint(&mut self, model: &RenderState, ctx: &mut RenderContext, app: &AppContext) {
|
||||
let content = model.content();
|
||||
let code_block = extract_block!(self.viewport_item, content, (block, BlockItem::RunnableCodeBlock{code_block_type: _, paragraph_block}) => block.code_block(paragraph_block));
|
||||
let code_block = extract_block!(self.viewport_item, content, (block, BlockItem::RunnableCodeBlock{paragraph_block, ..}) => block.code_block(paragraph_block));
|
||||
|
||||
let styles = model.styles();
|
||||
let code_style = &styles.code_text;
|
||||
@@ -94,7 +88,7 @@ impl RenderableBlock for RenderableRunnableCommand {
|
||||
// `RichTextElement::content_z_index` for context.
|
||||
ctx.paint
|
||||
.scene
|
||||
.start_layer(galaxyui::ClipBounds::ActiveLayer);
|
||||
.start_layer(galaxyui_core::ClipBounds::ActiveLayer);
|
||||
|
||||
// Position the block footer right below the content area, flush with its right-hand edge.
|
||||
// This gives the footer some padding relative to the visible area with a background.
|
||||
@@ -109,15 +103,19 @@ impl RenderableBlock for RenderableRunnableCommand {
|
||||
ctx.paint.scene.stop_layer();
|
||||
}
|
||||
|
||||
fn after_layout(&mut self, ctx: &mut galaxyui::AfterLayoutContext, app: &galaxyui::AppContext) {
|
||||
fn after_layout(
|
||||
&mut self,
|
||||
ctx: &mut galaxyui_core::AfterLayoutContext,
|
||||
app: &galaxyui_core::AppContext,
|
||||
) {
|
||||
self.footer.after_layout(ctx, app);
|
||||
}
|
||||
|
||||
fn dispatch_event(
|
||||
&mut self,
|
||||
_model: &crate::render::model::RenderState,
|
||||
event: &galaxyui::event::DispatchedEvent,
|
||||
ctx: &mut galaxyui::EventContext,
|
||||
event: &galaxyui_core::event::DispatchedEvent,
|
||||
ctx: &mut galaxyui_core::EventContext,
|
||||
app: &AppContext,
|
||||
) -> bool {
|
||||
self.footer.dispatch_event(event, ctx, app)
|
||||
|
||||
Reference in New Issue
Block a user