Fixed scroll direction of page menu in RTL
authorAlexander Ebert <ebert@woltlab.com>
Sun, 9 Oct 2016 19:36:51 +0000 (21:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 9 Oct 2016 19:36:51 +0000 (21:36 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Abstract.js

index c798075e3dfb34633f74133f4ddadc20f85e12a2..2d059d2c52777fc246a0b0aead6c18b8551818b2 100644 (file)
@@ -6,7 +6,7 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLabSuite/Core/Ui/Page/Menu/Abstract
  */
-define(['Core', 'Environment', 'EventHandler', 'ObjectMap', 'Dom/Traverse', 'Dom/Util', 'Ui/Screen'], function(Core, Environment, EventHandler, ObjectMap, DomTraverse, DomUtil, UiScreen) {
+define(['Core', 'Environment', 'EventHandler', 'Language', 'ObjectMap', 'Dom/Traverse', 'Dom/Util', 'Ui/Screen'], function(Core, Environment, EventHandler, Language, ObjectMap, DomTraverse, DomUtil, UiScreen) {
        "use strict";
        
        var _pageContainer = elById('pageContainer');
@@ -534,7 +534,13 @@ define(['Core', 'Environment', 'EventHandler', 'ObjectMap', 'Dom/Traverse', 'Dom
                _updateDepth: function(increase) {
                        this._depth += (increase) ? 1 : -1;
                        
-                       this._menu.children[0].style.setProperty('transform', 'translateX(' + (this._depth * -100) + '%)', '');
+                       var offset = this._depth * -100;
+                       if (Language.get('wcf.global.pageDirection') === 'rtl') {
+                               // reverse logic for RTL
+                               offset *= -1;
+                       }
+                       
+                       this._menu.children[0].style.setProperty('transform', 'translateX(' + offset + '%)', '');
                },
                
                _updateButtonState: function() {