| @@ 26-82 (lines=57) @@ | ||
| 23 | * @formatter:on */ | |
| 24 | namespace AframeVR\Core\Components\Position\Methods; | |
| 25 | ||
| 26 | class DefaultMethods | |
| 27 | { | |
| 28 | /** | |
| 29 | * When any position component methods are called then init others | |
| 30 | * | |
| 31 | * @param array $dom_attributes | |
| 32 | * @return void | |
| 33 | */ | |
| 34 | private function init(array &$dom_attributes) | |
| 35 |     { | |
| 36 | $dom_attributes['x'] = $dom_attributes['x'] ?? 0; | |
| 37 | $dom_attributes['y'] = $dom_attributes['y'] ?? 0; | |
| 38 | $dom_attributes['z'] = $dom_attributes['z'] ?? 0; | |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Negative X axis extends left. | |
| 43 | * Positive X Axis extends right. | |
| 44 | * | |
| 45 | * @param array $dom_attributes | |
| 46 | * @param double $x_axis | |
| 47 | * @return void | |
| 48 | */ | |
| 49 | public function positionX(array &$dom_attributes, float $x_axis) | |
| 50 |     { | |
| 51 | $this->init($dom_attributes); | |
| 52 | $dom_attributes['x'] = $x_axis; | |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * Negative Y axis extends up. | |
| 57 | * Positive Y Axis extends down. | |
| 58 | * | |
| 59 | * @param array $dom_attributes | |
| 60 | * @param double $y_axis | |
| 61 | * @return void | |
| 62 | */ | |
| 63 | public function positionY(array &$dom_attributes, float $y_axis) | |
| 64 |     { | |
| 65 | $this->init($dom_attributes); | |
| 66 | $dom_attributes['y'] = $y_axis; | |
| 67 | } | |
| 68 | ||
| 69 | /** | |
| 70 | * Negative Z axis extends in. | |
| 71 | * Positive Z Axis extends out. | |
| 72 | * | |
| 73 | * @param array $dom_attributes | |
| 74 | * @param double $z_axis | |
| 75 | * @return void | |
| 76 | */ | |
| 77 | public function positionZ(array &$dom_attributes, float $z_axis) | |
| 78 |     { | |
| 79 | $this->init($dom_attributes); | |
| 80 | $dom_attributes['z'] = $z_axis; | |
| 81 | } | |
| 82 | } | |
| 83 | ||
| @@ 26-79 (lines=54) @@ | ||
| 23 | * @formatter:on */ | |
| 24 | namespace AframeVR\Core\Components\Rotation\Methods; | |
| 25 | ||
| 26 | class DefaultMethods | |
| 27 | { | |
| 28 | /** | |
| 29 | * When any rotation component methods are called then init others | |
| 30 | * | |
| 31 | * @param array $dom_attributes | |
| 32 | * @return void | |
| 33 | */ | |
| 34 | private function init(array &$dom_attributes) | |
| 35 |     { | |
| 36 | $dom_attributes['x'] = $dom_attributes['x'] ?? 0; | |
| 37 | $dom_attributes['y'] = $dom_attributes['y'] ?? 0; | |
| 38 | $dom_attributes['z'] = $dom_attributes['z'] ?? 0; | |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Roll, rotation about the X-axis. | |
| 43 | * | |
| 44 | * @param array $dom_attributes | |
| 45 | * @param double $roll | |
| 46 | * @return void | |
| 47 | */ | |
| 48 | public function roll(array &$dom_attributes, float $roll) | |
| 49 |     { | |
| 50 | $this->init($dom_attributes); | |
| 51 | $dom_attributes['x'] = $roll; | |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 | * Pitch, rotation about the Y-axis. | |
| 56 | * | |
| 57 | * @param array $dom_attributes | |
| 58 | * @param double $pitch | |
| 59 | * @return void | |
| 60 | */ | |
| 61 | public function pitch(array &$dom_attributes, float $pitch) | |
| 62 |     { | |
| 63 | $this->init($dom_attributes); | |
| 64 | $dom_attributes['y'] = $pitch; | |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * Yaw, rotation about the Z-axis. | |
| 69 | * | |
| 70 | * @param array $dom_attributes | |
| 71 | * @param double $yaw | |
| 72 | * @return void | |
| 73 | */ | |
| 74 | public function yaw(array &$dom_attributes, float $yaw) | |
| 75 |     { | |
| 76 | $this->init($dom_attributes); | |
| 77 | $dom_attributes['z'] = $yaw; | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| @@ 26-79 (lines=54) @@ | ||
| 23 | * @formatter:on */ | |
| 24 | namespace AframeVR\Core\Components\Scale\Methods; | |
| 25 | ||
| 26 | class DefaultMethods | |
| 27 | { | |
| 28 | /** | |
| 29 | * When any scale component methods are called then init others | |
| 30 | * | |
| 31 | * @param array $dom_attributes | |
| 32 | * @return void | |
| 33 | */ | |
| 34 | private function init(array &$dom_attributes) | |
| 35 |     { | |
| 36 | $dom_attributes['x'] = $dom_attributes['x'] ?? 0; | |
| 37 | $dom_attributes['y'] = $dom_attributes['y'] ?? 0; | |
| 38 | $dom_attributes['z'] = $dom_attributes['z'] ?? 0; | |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Scaling factor in the X direction. | |
| 43 | * | |
| 44 | * @param array $dom_attributes | |
| 45 | * @param double $scale_x | |
| 46 | * @return void | |
| 47 | */ | |
| 48 | public function scaleX(array &$dom_attributes, float $scale_x) | |
| 49 |     { | |
| 50 | $this->init($dom_attributes); | |
| 51 | $dom_attributes['x'] = $scale_x; | |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 | * Scaling factor in the Y direction.. | |
| 56 | * | |
| 57 | * @param array $dom_attributes | |
| 58 | * @param double $scale_y | |
| 59 | * @return void | |
| 60 | */ | |
| 61 | public function scaleY(array &$dom_attributes, float $scale_y) | |
| 62 |     { | |
| 63 | $this->init($dom_attributes); | |
| 64 | $dom_attributes['y'] = $scale_y; | |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * Scaling factor in the Z direction. | |
| 69 | * | |
| 70 | * @param array $dom_attributes | |
| 71 | * @param double $scale_z | |
| 72 | * @return void | |
| 73 | */ | |
| 74 | public function scaleZ(array &$dom_attributes, float $scale_z) | |
| 75 |     { | |
| 76 | $this->init($dom_attributes); | |
| 77 | $dom_attributes['z'] = $scale_z; | |
| 78 | } | |
| 79 | } | |
| 80 | ||