royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piotr Zarzycki <piotrzarzyck...@gmail.com>
Subject Re: [royale-asjs] branch develop updated: Allow detection of default scrollbar width
Date Sun, 12 Nov 2017 16:24:38 GMT
Hi Yishay,

I like that bead. Just quick question. This class resolves some problems
with scroll bar for whole document. Am I thinking correctly? Can we have
such problems for scrollbars in nested elements where scrollbar appears ?

Thanks, Piotr

On Sun, Nov 12, 2017, 16:19 <yishayw@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> yishayw pushed a commit to branch develop
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
>
>
> The following commit(s) were added to refs/heads/develop by this push:
>      new 200d4f0  Allow detection of default scrollbar width
>      new 2f0b056  Merge branch 'develop' of
> https://github.com/apache/royale-asjs into develop
> 200d4f0 is described below
>
> commit 200d4f097254163100c646192678bdaf112030c2
> Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
> AuthorDate: Sun Nov 12 17:18:31 2017 +0200
>
>     Allow detection of default scrollbar width
> ---
>  .../Basic/src/main/resources/basic-manifest.xml    |  2 +
>  .../apache/royale/html/beads/GetScrollbarWidth.as  | 71
> ++++++++++++++++++++++
>  2 files changed, 73 insertions(+)
>
> diff --git
> a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
> b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
> index 4adafe9..90b72b3 100644
> --- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
> +++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
> @@ -108,6 +108,8 @@
>       <component id="HRuleView"
> class="org.apache.royale.html.beads.HRuleView" />
>       <component id="VRuleView"
> class="org.apache.royale.html.beads.VRuleView" />
>       -->
> +
> +    <component id="GetScrollbarWidth"
> class="org.apache.royale.html.beads.GetScrollbarWidth"/>
>      <component id="UnselectableElementBead"
> class="org.apache.royale.html.beads.UnselectableElementBead"/>
>      <component id="DisableBead"
> class="org.apache.royale.html.beads.DisableBead" />
>      <component id="DisabledAlphaBead"
> class="org.apache.royale.html.beads.DisabledAlphaBead" />
> diff --git
> a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GetScrollbarWidth.as
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GetScrollbarWidth.as
> new file mode 100644
> index 0000000..91f546e
> --- /dev/null
> +++
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GetScrollbarWidth.as
> @@ -0,0 +1,71 @@
>
> +////////////////////////////////////////////////////////////////////////////////
> +//
> +//  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.royale.html.beads
> +{
> +       import org.apache.royale.core.IBead;
> +       import org.apache.royale.core.IStrand;
> +       COMPILE::JS
> +       {
> +               import org.apache.royale.core.WrappedHTMLElement;
> +       }
> +
> +    /**
> +     *  The GetScrollbarWidth class detects the browser's default
> +        *  scrollbar width. This can be useful when changing the viewport
> +        *  width to avoid it being obstructed by the scrollbar.
> +     *
> +     *  @langversion 3.0
> +     *  @playerversion Flash 10.2
> +     *  @playerversion AIR 2.6
> +     *  @productversion Royale 0.9
> +     */
> +       public class GetScrollbarWidth implements IBead
> +       {
> +               private var _scrollbarWidth:Number;
> +
> +               public function GetScrollbarWidth()
> +               {
> +               }
> +
> +        /**
> +         * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
> +         */
> +               public function set strand (value:IStrand):void
> +               {
> +                       COMPILE::JS
> +                       {
> +                               var outerDiv:WrappedHTMLElement =
> document.createElement("div") as WrappedHTMLElement;
> +                               document.body.appendChild(outerDiv);
> +                               outerDiv.style.overflow = "scroll";
> +                               outerDiv.style.width = "50px";
> +                               var innerDiv:WrappedHTMLElement =
> document.createElement("div") as WrappedHTMLElement;
> +                               innerDiv.style.width = "100%";
> +                               outerDiv.appendChild(innerDiv);
> +                               _scrollbarWidth = outerDiv.offsetWidth -
> innerDiv.offsetWidth;
> +                               document.body.removeChild(outerDiv);
> +                       }
> +               }
> +
> +               public function get scrollbarWidth():Number
> +               {
> +                       return _scrollbarWidth;
> +               }
> +       }
> +}
> +
>
> --
> To stop receiving notification emails like this one, please contact
> ['"commits@royale.apache.org" <commits@royale.apache.org>'].
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message