Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUISegmentBarSegmentView.php
Show All 20 Lines | public function setColor($color) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setPosition($position) { | public function setPosition($position) { | ||||
$this->position = $position; | $this->position = $position; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* Set a Tooltip. | |||||
* @param string|null $tooltip | |||||
* @return self | |||||
*/ | |||||
public function setTooltip($tooltip) { | public function setTooltip($tooltip) { | ||||
$this->tooltip = $tooltip; | $this->tooltip = $tooltip; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function canAppendChild() { | protected function canAppendChild() { | ||||
return false; | return false; | ||||
} | } | ||||
Show All 13 Lines | protected function getTagAttributes() { | ||||
$width = ceil(100 * $width) / 100; | $width = ceil(100 * $width) / 100; | ||||
$width = sprintf('%.2f%%', $width); | $width = sprintf('%.2f%%', $width); | ||||
$left = 100 * $this->position; | $left = 100 * $this->position; | ||||
$left = floor(100 * $left) / 100; | $left = floor(100 * $left) / 100; | ||||
$left = sprintf('%.2f%%', $left); | $left = sprintf('%.2f%%', $left); | ||||
$tooltip = $this->tooltip; | $tooltip = $this->tooltip; | ||||
if (strlen($tooltip)) { | if (phutil_nonempty_string($tooltip)) { | ||||
Javelin::initBehavior('phabricator-tooltips'); | Javelin::initBehavior('phabricator-tooltips'); | ||||
$sigil = 'has-tooltip'; | $sigil = 'has-tooltip'; | ||||
$meta = array( | $meta = array( | ||||
'tip' => $tooltip, | 'tip' => $tooltip, | ||||
'align' => 'E', | 'align' => 'E', | ||||
); | ); | ||||
} else { | } else { | ||||
Show All 13 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0