* Prevent flickering (#10)

Co-authored-by: Santiago Cattaneo <santiago@rd-its.com>
This commit is contained in:
elgransan 2022-07-29 18:25:53 -03:00 committed by GitHub
parent 77e429792f
commit 9cefa60d15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,6 +45,7 @@
Dictionary<int, ElementReference> itemElem = new();
ElementReference reorder;
point elemPosition = new point(-1000, 0);
clientRect? elemRect;
point ghostTrans = new point(0, 0);
point clickPosition = new point(0, 0);
int elemWidth = 0;
@ -106,6 +107,7 @@
var ghostElem = itemElem[index];
elemWidth = await rs.getWidth(ghostElem);
elemPosition = await rs.getPosition(ghostElem);
elemRect = await rs.getClientRect(ghostElem);
clickPosition = await rs.getPoint(pageX, pageY, clientX, clientY);
TItem? clone = Copy != null ? Copy(item) : default(TItem);
@ -175,7 +177,7 @@
var box = await rs.getClientRect(item);
if (box.width < 0) return false;
var isx = (pos.x > box.left && pos.x < (box.left + box.width));
var isy = (pos.y > box.top && pos.y < (box.top + box.height));
var isy = (pos.y > box.top && pos.y < (box.top + Math.Min(box.height, elemRect?.height ?? 100000)));
var res = isx && isy;
return res;