fix offset calculation when parent has margin/padding