function computeThreshold(threshold, safeZone, itemSize, targetSize) {
    THRESHOLD_DATA.value = Math.min(targetSize / 2, threshold);
    THRESHOLD_DATA.offset =
      Math.max(0, itemSize + THRESHOLD_DATA.value * 2 + targetSize * safeZone - targetSize) / 2;
    return THRESHOLD_DATA;
  }
Compute threshold value and edge offset.

@param {Number} threshold
@param {Number} safeZone
@param {Number} itemSize
@param {Number} targetSize
@returns {Object}