Skip to content

Commit

Permalink
More sidebar and button scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
KyNorthstar committed Apr 21, 2018
1 parent 0e95885 commit 1ef49fc
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ this['BHStudios General Scripts'] = function (_, Kotlin) {
simpleName: 'ButtonViewWrapper',
interfaces: [WrappedHtmlView]
};
function SidebarButtonController(buttonModel, sidebarController) {
this.buttonModel = buttonModel;
this.sidebarController = sidebarController;
this.buttonModel.delegate = this;
}
SidebarButtonController.prototype.didPress_9ojx7i$ = function (event) {
this.sidebarController.toggleHidden();
};
SidebarButtonController.$metadata$ = {
kind: Kind_CLASS,
simpleName: 'SidebarButtonController',
interfaces: [ButtonModelDelegate]
};
var sidebarHiddenClass;
Delegates$observable$ObjectLiteral_1.prototype = Object.create(ObservableProperty.prototype);
Delegates$observable$ObjectLiteral_1.prototype.constructor = Delegates$observable$ObjectLiteral_1;
Expand Down Expand Up @@ -194,6 +207,9 @@ this['BHStudios General Scripts'] = function (_, Kotlin) {
addClass_0(this.view, [sidebarHiddenClass]);
}
};
SidebarController.prototype.toggleHidden = function () {
this.model.isShown = !this.model.isShown;
};
function SidebarController$model$lambda(this$SidebarController, closure$model) {
return function (f, f_0, newDelegate) {
closure$model.delegate = this$SidebarController;
Expand Down Expand Up @@ -289,6 +305,7 @@ this['BHStudios General Scripts'] = function (_, Kotlin) {
package$button.ButtonModelDelegate = ButtonModelDelegate;
package$button.ButtonViewWrapper = ButtonViewWrapper;
var package$sidebar = package$components.sidebar || (package$components.sidebar = {});
package$sidebar.SidebarButtonController = SidebarButtonController;
Object.defineProperty(package$sidebar, 'sidebarHiddenClass', {
get: function () {
return sidebarHiddenClass;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package org.bh.scripts.general.components.button

import org.w3c.dom.events.Event
import kotlin.properties.Delegates



typealias GenericEvent = (Event) -> Unit



Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
package org.bh.scripts.general.components.sidebar

import org.bh.scripts.general.components.button.*
import org.w3c.dom.events.*


/**
* @author Ben Leggiero
* @since 2018-04-19
*/
TODO
class SidebarButtonController(val buttonModel: ButtonModel,
val sidebarController: SidebarController): ButtonModelDelegate {

init {
buttonModel.delegate = this
}

override fun didPress(event: Event) {
sidebarController.toggleHidden()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ class SidebarController(
model.delegate = this
}


var view: SidebarViewWrapper by Delegates.observable(view) { _, _, newView ->
suppressChangeReactions = true
model.loadFromView(view)
suppressChangeReactions = false
}


override fun didShowOrHide(oldIsShown: Boolean, newIsShown: Boolean) {
if (suppressChangeReactions) { return }

Expand All @@ -40,6 +42,11 @@ class SidebarController(
view.addClass(sidebarHiddenClass)
}
}


fun toggleHidden() {
model.isShown = !model.isShown
}
}


Expand Down

0 comments on commit 1ef49fc

Please sign in to comment.