Fixed bad logic while computing canvas offset