code: function getGrid(step, source, target) {
  
          return {
              source: source.clone(),
              x: getGridDimension(target.x - source.x, step),
              y: getGridDimension(target.y - source.y, step)
          };
      }
docs: get grid size in x and y dimensions, adapted to source and target positions