use f32 for note coordinates
This commit is contained in:
parent
791b63c149
commit
40c5d2c938
1 changed files with 16 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
//! See [here](https://github.com/rr-/szurubooru/blob/master/doc/API.md#field-selecting) for
|
//! See [here](https://github.com/rr-/szurubooru/blob/master/doc/API.md#field-selecting) for
|
||||||
//! more information.
|
//! more information.
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
use crate::errors::SzurubooruClientError;
|
use crate::errors::SzurubooruClientError;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use derive_builder::Builder;
|
use derive_builder::Builder;
|
||||||
|
|
@ -625,7 +626,7 @@ pub struct RateResource {
|
||||||
pub score: i8,
|
pub score: i8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
all(feature = "python"),
|
all(feature = "python"),
|
||||||
pyclass(get_all, module = "szurubooru_client.models")
|
pyclass(get_all, module = "szurubooru_client.models")
|
||||||
|
|
@ -637,11 +638,24 @@ pub struct NoteResource {
|
||||||
/// For example, `[[0,0],[0,1],[1,1],[1,0]]` will draw the annotation on the whole post,
|
/// For example, `[[0,0],[0,1],[1,1],[1,0]]` will draw the annotation on the whole post,
|
||||||
/// whereas `[[0,0],[0,0.5],[0.5,0.5],[0.5,0]]` will draw it inside the post's upper left
|
/// whereas `[[0,0],[0,0.5],[0.5,0.5],[0.5,0]]` will draw it inside the post's upper left
|
||||||
/// quarter
|
/// quarter
|
||||||
pub polygon: Vec<Vec<u8>>,
|
pub polygon: Vec<Vec<f32>>,
|
||||||
/// The annotation text, in Markdown format
|
/// The annotation text, in Markdown format
|
||||||
pub text: String,
|
pub text: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for NoteResource {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.text == other.text &&
|
||||||
|
self.polygon.len() == other.polygon.len() &&
|
||||||
|
self.polygon.iter().zip(other.polygon.iter()).all(|(a, b)| {
|
||||||
|
a.len() == b.len() &&
|
||||||
|
a.iter().zip(b.iter()).all(|(a, b)| a.total_cmp(b) == Ordering::Equal)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Eq for NoteResource {}
|
||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[cfg_attr(all(feature = "python"), pymethods)]
|
#[cfg_attr(all(feature = "python"), pymethods)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue