fixed labelline + FML control update

This commit is contained in:
kremsy 2017-03-30 17:11:27 +02:00
parent 63ee8a9ae4
commit e39b903ebd
3 changed files with 888 additions and 856 deletions

View File

@ -243,7 +243,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$labelLine->addLabelEntryText($map->id, $posX + 3.5, 9); $labelLine->addLabelEntryText($map->id, $posX + 3.5, 9);
$labelLine->addLabelEntryText($map->name, $posX + 12.5, 38.5); $labelLine->addLabelEntryText($map->name, $posX + 12.5, 38.5);
$labelLine->addLabelEntryText($map->author, $posX + 59,-1,self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author); //FIXME with > 1 disables the ml $labelLine->addLabelEntryText($map->author, $posX + 59, 44, self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author);
$labelLine->addLabelEntryText(str_replace('Arena', '', $map->maptype), $posX + 103, 15); $labelLine->addLabelEntryText(str_replace('Arena', '', $map->maptype), $posX + 103, 15);
$labelLine->addLabelEntryText($map->mood, $posX + 118, 12); $labelLine->addLabelEntryText($map->mood, $posX + 118, 12);
$labelLine->addLabelEntryText($time, $posX + 130, $width - ($posX + 130)); $labelLine->addLabelEntryText($time, $posX + 130, $width - ($posX + 130));
@ -251,7 +251,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$labelLine->setPrefix('$s'); $labelLine->setPrefix('$s');
$labelLine->render(); $labelLine->render();
$mapFrame->setY($posY); $mapFrame->setY($posY);
$mxQuad = new Quad(); $mxQuad = new Quad();

View File

@ -52,6 +52,7 @@ class LabelLine implements UsageInformationAble {
} }
if ($width) { if ($width) {
$label->setWidth($width); $label->setWidth($width);
$label->setHeight(5); //TODO verify if 5 is ok for everywhere
} }
$this->addLabel($label); $this->addLabel($label);
} }

View File

@ -327,7 +327,8 @@ abstract class Control implements Identifiable, Renderable, ScriptFeatureable
* @api * @api
* @param string $horizontalAlign Horizontal alignment * @param string $horizontalAlign Horizontal alignment
* @return static * @return static
* @deprecated Use setHorizontalAlign() instead * @deprecated Use setHorizontalAlign()
* @see Control::setHorizontalAlign()
*/ */
public function setHAlign($horizontalAlign) public function setHAlign($horizontalAlign)
{ {
@ -364,7 +365,8 @@ abstract class Control implements Identifiable, Renderable, ScriptFeatureable
* @api * @api
* @param string $verticalAlign Vertical alignment * @param string $verticalAlign Vertical alignment
* @return static * @return static
* @deprecated * @deprecated Use setVerticalAlign()
* @see Control::setVerticalAlign()
*/ */
public function setVAlign($verticalAlign) public function setVAlign($verticalAlign)
{ {
@ -676,12 +678,28 @@ abstract class Control implements Identifiable, Renderable, ScriptFeatureable
return $this; return $this;
} }
/**
* Add new Script Features
*
* @api
* @param ScriptFeature[] $scriptFeatures Script Features
* @return static
*/
public function addScriptFeatures(array $scriptFeatures)
{
foreach ($scriptFeatures as $scriptFeature) {
$this->addScriptFeature($scriptFeature);
}
return $this;
}
/** /**
* Remove all Script Features * Remove all Script Features
* *
* @api * @api
* @return static * @return static
* @deprecated use removeAllScriptFeatures() instead * @deprecated Use removeAllScriptFeatures()
* @see Control::removeAllScriptFeatures()
*/ */
public function removeScriptFeatures() public function removeScriptFeatures()
{ {
@ -834,14 +852,28 @@ abstract class Control implements Identifiable, Renderable, ScriptFeatureable
if ($this->controlId) { if ($this->controlId) {
$domElement->setAttribute("id", $this->controlId); $domElement->setAttribute("id", $this->controlId);
} }
if ($this->posX || $this->posY) {
$domElement->setAttribute("pos", "{$this->posX} {$this->posY}");
}
if ($this->posX || $this->posY || $this->posZ) { if ($this->posX || $this->posY || $this->posZ) {
// backwards-compatibility
$domElement->setAttribute("posn", "{$this->posX} {$this->posY} {$this->posZ}"); $domElement->setAttribute("posn", "{$this->posX} {$this->posY} {$this->posZ}");
} }
if ($this->posZ) { if ($this->posZ) {
$domElement->setAttribute("z-index", $this->posZ); $domElement->setAttribute("z-index", $this->posZ);
} }
if ($this->width >= 0. || $this->height >= 0.) { if ($this->width >= 0. || $this->height >= 0.) {
$domElement->setAttribute("size", "{$this->width} {$this->height}");
// backwards-compatibility
$domElement->setAttribute("sizen", "{$this->width} {$this->height}"); $domElement->setAttribute("sizen", "{$this->width} {$this->height}");
if ($this->width >= 0.) {
// backwards-compatibility
$domElement->setAttribute("width", $this->width);
}
if ($this->height >= 0.) {
// backwards-compatibility
$domElement->setAttribute("height", $this->height);
}
} }
if ($this->horizontalAlign) { if ($this->horizontalAlign) {
$domElement->setAttribute("halign", $this->horizontalAlign); $domElement->setAttribute("halign", $this->horizontalAlign);
@ -858,7 +890,7 @@ abstract class Control implements Identifiable, Renderable, ScriptFeatureable
if ($this->rotation) { if ($this->rotation) {
$domElement->setAttribute("rot", $this->rotation); $domElement->setAttribute("rot", $this->rotation);
} }
if (!empty($this->classes)) { if ($this->classes) {
$classes = implode(" ", $this->classes); $classes = implode(" ", $this->classes);
$domElement->setAttribute("class", $classes); $domElement->setAttribute("class", $classes);
} }