mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Render text properly while dragging and resizing the text Shape
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
use super::{RenderState, SurfaceId};
|
||||
use super::{RenderState, Shape, SurfaceId};
|
||||
use crate::shapes::TextContent;
|
||||
|
||||
pub fn render(render_state: &mut RenderState, text: &TextContent) {
|
||||
let mut offset_y = 0.0;
|
||||
pub fn render(render_state: &mut RenderState, shape: &Shape, text: &TextContent) {
|
||||
for mut skia_paragraph in text.to_paragraphs(&render_state.fonts().font_collection()) {
|
||||
skia_paragraph.layout(text.width());
|
||||
skia_paragraph.layout(shape.width());
|
||||
|
||||
let xy = (text.x(), text.y() + offset_y);
|
||||
let xy = (shape.selrect().x(), shape.selrect.y());
|
||||
skia_paragraph.paint(render_state.surfaces.canvas(SurfaceId::Fills), xy);
|
||||
offset_y += skia_paragraph.height();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user