Text View Mode highlighting problem #366
Replies: 2 comments 1 reply
-
Thank you for opening this discussion @ayya-vimala , let's brainstorm and I'm sure we can figure something out. I'll respond to some points in the meantime:
Yes, it's very easy to do. As for your main idea, I like it. My suggestion would be to use the
This example is not completely clear to me, and it seems to contain some duplicated data. I think we should try to describe a minimal example and remove any redundant properties that wouldn't be needed anymore with this approach. How does the FE determine what to highlight in this approach, on a low level? Can you try to describe it with pseudocode? Are you proposing to do a string comparison? I don't understand the addition of
This makes sense, but it's going to complicate some logic on the FE side. We would probably have to introduce a persistent state variable other than |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I've been thinking about the logic for the text-view.
Click on any part of the text in the left column, highlights the part where you clicked
active_segment
andactive_segment_index
are set and the middle view column opens with the details of the matches for the clicked part.Hovering over a middle view item (I'll call it 'match-card'), highlights the text in the left with a black background. Right now that background disappears as soon as you move away from that match-card. Is there a way to allow it to stay (and make it a more subtle grey or other color) until you hover over another card or reload the page/column?
Clicking on a match-card opens the right column and scrolls to the selected segment.
Here it becomes more complex as we don't know what to highlight! So I want to rubber-duck it!
On the left and right sides, the data that comes back has the following form:
This example is of one segment with 3 parts (so three potential "active_segment_indexes").
When clicking on the left for instance on the word-part "kathā", it requests the three matches:
from the backend middle view it returns for each of them something like this:
and displays them in the middle column.
(We can change this if needed to return
par_segnr
as an array rather than a string, so including ALL the segment numers betweenPA_ps_1.4:0.3
andPA_ps_1.4:1.2
as the range indicates)When looking at ArangoDB parallels, it has the following information for the parallel with the above id (see screenshot):
So there it has the information we need: It has the
par_offset_beg
andpar_offset_end
and thepar_segnr
array.From that, in a similar way as the current calculations for the middle view, the
text-view/middle
can start to give back info like this:Alternatively, this information can be derived at the frontend if the backend gives back a
par_segnr
as an array.To illustrate this:, if we have:
and
and
We can derive from there that the first segment
par_segnr[0]
matches withpar_segtext[0]
soPA_ps_1.4:0.3 = "1.4. Indriyakathā"
. Then looking at thepar_fulltext
we see that the first part of this match has highlightColor: 0 (1.4. Indriy
) and the second part has highlightColor: 1 (akathā
).For the next one
par_segnr[1]
and any potential following ones except the last one (in this casepar_segnr[2]
) everything has highlightColor: 1.For the last one
par_segnr[2]
the highlightColor: 0 forsāvatthiyaṁ viharati jetavane anāthapiṇḍikassa ārāme.
So I see a number of options here that should be doable.
This can than work from left to right and right to left.
I would also like
active_segment_index
to be ONLY used for when someone clicks on a segment in the right or left column and that segment-part can be made bold.Then I'd prefer not to use bold for the other highlighting as it has a different function. The other highlighting can be a subtle background color behind the text.
Let me know what you think.
Beta Was this translation helpful? Give feedback.
All reactions