From commits-return-22245-apmail-flex-commits-archive=flex.apache.org@flex.apache.org Thu Sep 3 18:46:27 2015 Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8769D179A1 for ; Thu, 3 Sep 2015 18:46:27 +0000 (UTC) Received: (qmail 92349 invoked by uid 500); 3 Sep 2015 18:46:22 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 92249 invoked by uid 500); 3 Sep 2015 18:46:22 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 92168 invoked by uid 99); 3 Sep 2015 18:46:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Sep 2015 18:46:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2F70FDFFD5; Thu, 3 Sep 2015 18:46:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Thu, 03 Sep 2015 18:46:24 -0000 Message-Id: <439371ba848c440bbcec5b1c632c688b@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/4] git commit: [flex-asjs] [refs/heads/develop] - add way to enable browser scrolling add way to enable browser scrolling Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fdd2e6b9 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fdd2e6b9 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fdd2e6b9 Branch: refs/heads/develop Commit: fdd2e6b921c8741e69c524ce4cd364b4b21c89de Parents: 51f8ce2 Author: Alex Harui Authored: Thu Sep 3 11:45:48 2015 -0700 Committer: Alex Harui Committed: Thu Sep 3 11:46:42 2015 -0700 ---------------------------------------------------------------------- .../flexjs/ChartExample/src/ChartExample.mxml | 4 +- .../src/org/apache/flex/core/BrowserScroller.as | 81 ++++++++++++++++++++ frameworks/projects/Core/basic-manifest.xml | 1 + .../src/org/apache/flex/core/BrowserScroller.js | 55 +++++++++++++ 4 files changed, 140 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdd2e6b9/examples/flexjs/ChartExample/src/ChartExample.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/ChartExample/src/ChartExample.mxml b/examples/flexjs/ChartExample/src/ChartExample.mxml index 6cf51d9..57bc2a4 100644 --- a/examples/flexjs/ChartExample/src/ChartExample.mxml +++ b/examples/flexjs/ChartExample/src/ChartExample.mxml @@ -23,7 +23,9 @@ xmlns:models="models.*" xmlns:js="library://ns.apache.org/flexjs/basic" > - + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdd2e6b9/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as new file mode 100644 index 0000000..355453a --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as @@ -0,0 +1,81 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + import flash.external.ExternalInterface; + import flash.utils.getQualifiedClassName; + + import org.apache.flex.events.Event; + + /** + * The BrowserScroller class enables browser scrollbars + * when the application is larger than the screen. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class BrowserScroller implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function BrowserScroller() + { + } + + private var app:Application; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + app = value as Application; + app.addEventListener("viewChanged", viewChangedHandler); + } + + private function viewChangedHandler(event:Event):void + { + // some day also listen to initial view for size changes + if (ExternalInterface.available) + { + // Get application name. This assumes that the wrapper is using an + // object tag with the id that matches the application name + var appName:String = getQualifiedClassName(app); + var js:String = "var o = document.getElementById('" + appName + "');"; + js += "o.width = " + app.initialView.width.toString() + ";"; + js += "o.height = " + app.initialView.height.toString() + ";" + ExternalInterface.call("eval", js); + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdd2e6b9/frameworks/projects/Core/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/basic-manifest.xml b/frameworks/projects/Core/basic-manifest.xml index 995157d..65f0db8 100644 --- a/frameworks/projects/Core/basic-manifest.xml +++ b/frameworks/projects/Core/basic-manifest.xml @@ -22,6 +22,7 @@ + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdd2e6b9/frameworks/projects/Core/js/src/org/apache/flex/core/BrowserScroller.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/BrowserScroller.js b/frameworks/projects/Core/js/src/org/apache/flex/core/BrowserScroller.js new file mode 100644 index 0000000..e6a4987 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/BrowserScroller.js @@ -0,0 +1,55 @@ +/** + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +goog.provide('org.apache.flex.core.BrowserScroller'); + + + +/** + * @constructor + */ +org.apache.flex.core.BrowserScroller = function() { + this.strand_ = null; +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org.apache.flex.core.BrowserScroller.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'BrowserScroller', + qName: 'org.apache.flex.core.BrowserScroller'}]}; + + +/** + * @param {Event} e The event. + */ +org.apache.flex.core.BrowserScroller.prototype.viewChangedHandler = function(e) { + this.strand_.element.style.overflow = 'auto'; +}; + + +Object.defineProperties(org.apache.flex.core.BrowserScroller.prototype, { + /** @export */ + strand: { + /** @this {org.apache.flex.core.BrowserScroller} */ + set: function(value) { + this.strand_ = value; + value.addEventListener('viewChanged', + goog.bind(this.viewChangedHandler, this)); + } + } +});