show absolutely positioned comment (not relative to zoom)

This commit is contained in:
isUnknown 2024-11-11 15:06:56 +01:00
parent 14321b1e8d
commit 7d2343fc4d
6 changed files with 91 additions and 7 deletions

View file

@ -5,7 +5,6 @@ namespace adrienpayet\comments;
class BaseComment {
protected $page;
protected $file;
protected $filePageIndex;
protected $position;
protected $replies;
protected $text;
@ -18,7 +17,7 @@ class BaseComment {
public function __construct($data) {
$page = $data['page'];
$file = $data['file'];
$filePageIndex = $data['filePageIndex'];
$position = $data['position'];
$replies = $data['replies'] ?? [];
$text = $data['text'];
$author = $data['author'];
@ -32,7 +31,6 @@ class BaseComment {
];
$this->file = [
'uuid' => (string) $file->uuid(),
'pageIndex' => $filePageIndex,
];
$this->replies = $replies ?? [];
$this->text = $text;
@ -46,6 +44,7 @@ class BaseComment {
$this->id = $id;
$this->type = $type;
$this->isRead = false;
$this->position = $position;
}
public function page() {
@ -94,6 +93,10 @@ class BaseComment {
return $this->isRead;
}
public function pageIndex() {
$this->position['pageIndex'];
}
public function toArray() {
return [
'page' => $this->page,
@ -101,6 +104,7 @@ class BaseComment {
'replies' => $this->replies,
'text' => $this->text,
'author' => $this->author,
'position' => $this->position,
'date' => $this->date,
'id' => $this->id,
'type' => $this->type,