From 9a88e5172ab572c9b1a40b0d69eceb08d729626b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 Feb 2015 16:05:57 -0800 Subject: [PATCH] [Common UI] Expose mct-scroll-x, mct-scroll-y Expose mct-scroll-x and mct-scroll-y directives. WTD-920. --- platform/commonUI/general/bundle.json | 28 +++++++++++++++++++ .../general/src/directives/MCTScroll.js | 6 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/general/bundle.json b/platform/commonUI/general/bundle.json index f7b60b096d..5bf767d2d1 100644 --- a/platform/commonUI/general/bundle.json +++ b/platform/commonUI/general/bundle.json @@ -105,6 +105,34 @@ "key": "mctResize", "implementation": "directives/MCTResize.js", "depends": [ "$timeout" ] + }, + { + "key": "mctScrollX", + "implementations": "directives/MCTScroll.js", + "depends": [ "$parse", "MCT_SCROLL_X_PROPERTY", "MCT_SCROLL_X_ATTRIBUTE" ] + }, + { + "key": "mctScrollY", + "implementations": "directives/MCTScroll.js", + "depends": [ "$parse", "MCT_SCROLL_Y_PROPERTY", "MCT_SCROLL_Y_ATTRIBUTE" ] + } + ], + "constants": [ + { + "key": "MCT_SCROLL_X_PROPERTY", + "value": "scrollLeft" + }, + { + "key": "MCT_SCROLL_X_ATTRIBUTE", + "value": "mctScrollX" + }, + { + "key": "MCT_SCROLL_Y_PROPERTY", + "value": "scrollTop" + }, + { + "key": "MCT_SCROLL_Y_ATTRIBUTE", + "value": "mctScrollY" } ], "containers": [ diff --git a/platform/commonUI/general/src/directives/MCTScroll.js b/platform/commonUI/general/src/directives/MCTScroll.js index d9abf810a1..f5b7a5b159 100644 --- a/platform/commonUI/general/src/directives/MCTScroll.js +++ b/platform/commonUI/general/src/directives/MCTScroll.js @@ -6,12 +6,16 @@ define( 'use strict'; /** - * Superclass of mct-scroll-x and mct-scroll-y directives. Listens + * Implements `mct-scroll-x` and `mct-scroll-y` directives. Listens * for scroll events and publishes their results into scope; watches * scope and updates scroll state to match. This varies for x- and y- * directives only by the attribute name chosen to find the expression, * and the property (scrollLeft or scrollTop) managed within the * element. + * + * This is exposed as two directives in `bundle.json`; the difference + * is handled purely by parameterization. + * * @constructor * @param $parse Angular's $parse * @param {string} property property to manage within the HTML element