protected function SvgIconBuilder::getOffset in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Layout/Icon/SvgIconBuilder.php \Drupal\Core\Layout\Icon\SvgIconBuilder::getOffset()
Gets the offset for this region.
Parameters
int $delta: The zero-based delta of the region.
int $length: The height or width of the region.
int $stroke_width: The width of the region borders.
int $padding: The padding between regions.
Return value
int The offset for this region.
1 call to SvgIconBuilder::getOffset()
- SvgIconBuilder::calculateSvgValues in core/
lib/ Drupal/ Core/ Layout/ Icon/ SvgIconBuilder.php - Calculates the dimensions and offsets of all regions.
File
- core/
lib/ Drupal/ Core/ Layout/ Icon/ SvgIconBuilder.php, line 205
Class
- SvgIconBuilder
- Builds SVG layout icons.
Namespace
Drupal\Core\Layout\IconCode
protected function getOffset($delta, $length, $stroke_width, $padding) {
// Half of the stroke width is drawn outside the dimensions.
$stroke_width /= 2;
// For every region in front of this add two strokes, as well as one
// directly in front.
$num_of_strokes = 2 * $delta + 1;
return $num_of_strokes * $stroke_width + $delta * ($length + $padding);
}