From 47114a18e3d6dc2090beeb43d03f865d6436a99a Mon Sep 17 00:00:00 2001 From: Debanshu Kundu Date: Thu, 2 Mar 2017 23:17:27 +0530 Subject: 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 --- webapp/utils/commons.jsx | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'webapp/utils/commons.jsx') 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; } -- cgit v1.2.3-1-g7c22