MCPcopy Index your code
hub / github.com/DHTMLX/gantt / coordsBidiPart

Function coordsBidiPart

samples/common/codehighlight/codemirror.js:2810–2832  ·  view source on GitHub ↗
(cm, lineObj, lineNo, preparedMeasure, order, x, y)

Source from the content-addressed store, hash-verified

2808 }
2809
2810 function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
2811 // Bidi parts are sorted left-to-right, and in a non-line-wrapping
2812 // situation, we can take this ordering to correspond to the visual
2813 // ordering. This finds the first part whose end is after the given
2814 // coordinates.
2815 var index = findFirst(function (i) {
2816 var part = order[i], ltr = part.level != 1;
2817 return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
2818 "line", lineObj, preparedMeasure), x, y, true)
2819 }, 0, order.length - 1);
2820 var part = order[index];
2821 // If this isn't the first part, the part's start is also after
2822 // the coordinates, and the coordinates aren't on the same line as
2823 // that start, move one part back.
2824 if (index > 0) {
2825 var ltr = part.level != 1;
2826 var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
2827 "line", lineObj, preparedMeasure);
2828 if (boxIsAfter(start, x, y, true) && start.top > y)
2829 { part = order[index - 1]; }
2830 }
2831 return part
2832 }
2833
2834 function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
2835 // In a wrapped line, rtl text on wrapping boundaries can do things

Callers

nothing calls this directly

Calls 4

findFirstFunction · 0.85
boxIsAfterFunction · 0.85
cursorCoordsFunction · 0.85
PosFunction · 0.85

Tested by

no test coverage detected