summaryrefslogtreecommitdiffstats
path: root/webapp/utils/commons.jsx
diff options
context:
space:
mode:
authorDebanshu Kundu <debanshu.kundu@joshtechnologygroup.com>2017-03-02 23:17:27 +0530
committerenahum <nahumhbl@gmail.com>2017-03-02 14:47:27 -0300
commit47114a18e3d6dc2090beeb43d03f865d6436a99a (patch)
treeb7126d5cb3bd025eb62228af0cb0f7994964c6fa /webapp/utils/commons.jsx
parentd9a297d6291838e08a4acdbd603c35601c0e9878 (diff)
downloadchat-47114a18e3d6dc2090beeb43d03f865d6436a99a.tar.gz
chat-47114a18e3d6dc2090beeb43d03f865d6436a99a.tar.bz2
chat-47114a18e3d6dc2090beeb43d03f865d6436a99a.zip
PLT-5380 Moved link preview image to top right corner of preview area (#5212)
* PLT-5380 Moved link preview image to top right corner of preview area for smaller images, larger and wide images are still shown below the text. Also added logic to hide image area if image loading fails. * Updating link previews css
Diffstat (limited to 'webapp/utils/commons.jsx')
-rw-r--r--webapp/utils/commons.jsx18
1 files changed, 1 insertions, 17 deletions
diff --git a/webapp/utils/commons.jsx b/webapp/utils/commons.jsx
index 1888869dc..224653df7 100644
--- a/webapp/utils/commons.jsx
+++ b/webapp/utils/commons.jsx
@@ -8,7 +8,6 @@ export function getDistanceBW2Points(point1, point2, xAttr = 'x', yAttr = 'y') {
*/
export function getNearestPoint(pivotPoint, points, xAttr = 'x', yAttr = 'y') {
var nearestPoint = {};
- var nearestPointLte = {}; // Nearest point smaller than or equal to point
for (const point of points) {
if (typeof nearestPoint[xAttr] === 'undefined' || typeof nearestPoint[yAttr] === 'undefined') {
nearestPoint = point;
@@ -16,21 +15,6 @@ export function getNearestPoint(pivotPoint, points, xAttr = 'x', yAttr = 'y') {
// Check for bestImage
nearestPoint = point;
}
-
- if (typeof nearestPointLte[xAttr] === 'undefined' || typeof nearestPointLte[yAttr] === 'undefined') {
- if (point[xAttr] <= pivotPoint[xAttr] && point[yAttr] <= pivotPoint[yAttr]) {
- nearestPointLte = point;
- }
- } else if (
- // Check for bestImageLte
- getDistanceBW2Points(point, pivotPoint, xAttr, yAttr) < getDistanceBW2Points(nearestPointLte, pivotPoint, xAttr, yAttr) &&
- point[xAttr] <= pivotPoint[xAttr] && point[yAttr] <= pivotPoint[yAttr]
- ) {
- nearestPointLte = point;
- }
}
- return {
- nearestPoint,
- nearestPointLte
- };
+ return nearestPoint;
}