forked from 1b-agent/opencadstudio-upstream
Table cells: read own overrides from either layout
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
df725a45da
commit
7277bf33dc
3 files changed
+7
-4
No files matched your search
Generated
+1
-1
@@ -4206,7 +4206,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opencadcodec"
|
||||
version = "0.5.5"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=435c736#435c736b79c3c62133ea34bd221263e58313b09f"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=22b3d1a#22b3d1a1afe9c799185eb6acac41b80db35a7989"
|
||||
dependencies = [
|
||||
"ahash 0.8.12",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aa
|
||||
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||
|
||||
[patch."https://github.com/HakanSeven12/opencadcodec.git"]
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "435c736" }
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "22b3d1a" }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
getrandom = "0.3"
|
||||
|
||||
@@ -101,12 +101,15 @@ pub(crate) fn style_for_property<'a>(
|
||||
cell: &'a codec::entities::table::TableCell,
|
||||
property: codec::entities::table::CellStylePropertyFlags,
|
||||
) -> Option<&'a codec::entities::table::CellStyle> {
|
||||
// The cell's own overrides, as either layout (DXF or binary) states them.
|
||||
if let Some(style) = cell.style.as_ref().filter(|style| style.sets(property)) {
|
||||
return Some(style);
|
||||
}
|
||||
let column_style = table
|
||||
.columns
|
||||
.get(column)
|
||||
.and_then(|column| column.style.as_ref());
|
||||
for style in [
|
||||
cell.style.as_ref(),
|
||||
row.style.as_ref(),
|
||||
column_style,
|
||||
table.base_style.as_ref(),
|
||||
@@ -132,7 +135,7 @@ fn cell_text_height(
|
||||
content: &codec::entities::table::CellContent,
|
||||
) -> Option<f64> {
|
||||
use codec::entities::table::CellStylePropertyFlags as P;
|
||||
let own = content.format_property_flags & P::TEXT_HEIGHT.bits() as i32 != 0;
|
||||
let own = content.sets(P::TEXT_HEIGHT);
|
||||
own.then_some(content.text_height)
|
||||
.or_else(|| style_for_property(table, row, column, cell, P::TEXT_HEIGHT).map(|s| s.text_height))
|
||||
.or(Some(content.text_height))
|
||||
|
||||
Reference in new issue
Block a user