Guessing but you can probably use image addLoadHandler() to wait for the
image to load before checking the height.

A more complex alternative is to download the image using a getRequest and
then transform it into a base64 dataUrl and use that as the src for your
image.

On Wed, Nov 26, 2014 at 8:31 PM, confile <[email protected]>
wrote:

> Richard what do you suggest to solve this problem?
>
>
> Am Mittwoch, 26. November 2014 19:01:02 UTC+1 schrieb Richard Wallis:
>>
>> @confile it is not possible to run your example because it is missing
>> dependencies.
>>
>> From reading the code, the problem you are having is probably not caused
>> by the Scheduler but by the time taken to resolve test.jpg.  After
>> modifying an element it is not necessary to pause before calling
>> getOffsetHeight(). The call itself will force a redraw and the value will
>> not change over time unless the element itself changes.
>>
>> In this case the height of the image element is changing as test.jpg
>> downloads, this is why your output is inconsistent.
>>
>>
>> On Wed, Nov 26, 2014 at 6:45 PM, confile <[email protected]>
>> wrote:
>>
>>> It is clear that Timer and Scheduler are different.
>>>
>>> My concern is that Scheduler.scheduleDeffered behaves so differnent on
>>> different platforms.
>>>
>>> What is the best way to handle this?
>>>
>>>
>>>
>>> Am Mittwoch, 26. November 2014 16:11:01 UTC+1 schrieb Jonathon Lamon:
>>>
>>>> Timer and Scheduler.scheduleDeffered would not be expected to be
>>>> equivalent.  They have two different semantics.
>>>>
>>>> Scheduler.scheduleDeffered - runs "after the browser event loop
>>>> returns".
>>>> new Timer().schedule(1000) - runs 1000 ms after being scheduled.
>>>>
>>>> You can not expect Scheduler.scheduleDeffered to give consistent
>>>> results across platform.
>>>>
>>>> Scheduler.scheduleFixedDelay would be more equivalent to Timer.schedule
>>>>
>>>> On Tuesday, November 25, 2014 6:47:04 AM UTC-7, confile wrote:
>>>>>
>>>>> It seems that the Scheduler works different on mobile and desktop when
>>>>> using SDM.
>>>>>
>>>>> I created a demo project (https://github.com/confile/GW
>>>>> T-2.7-Scheduler-Test) to show the problem.
>>>>>
>>>>> This is a demo app to test how the GWT Scheduler works different on
>>>>> mobile and on desktop in Super Dev Mode.
>>>>>
>>>>> I printed the height of a HTMLPanel for three different cases.
>>>>>
>>>>>    1. right after the DOM elements are inserted into the page (GWTP
>>>>>    onReveal())
>>>>>    2. right after the DOM elements are inserted into the page and
>>>>>    Scheduler with a deferred command is executed
>>>>>    3. right after the DOM elements are inserted into the page and a
>>>>>    Timer after 1000mx is fired
>>>>>
>>>>> Here is the difference in the console output:
>>>>> Output on Desktop
>>>>>
>>>>>    - height before Timer and Scheduler: 0
>>>>>    - height after Scheduler: 652
>>>>>    - height after Timer: 652
>>>>>
>>>>> Output on Mobile (iPhone 5, iOS 7.1.1)
>>>>>
>>>>>    - height before Timer and Scheduler: 0
>>>>>    - height after Scheduler: 425
>>>>>    - height after Timer: 817
>>>>>
>>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "GWT Contributors" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected]
>>> .
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/google-web-toolkit-contributors/93f92371-4bfe-
>>> 42c3-a1c8-44390e3fb543%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/93f92371-4bfe-42c3-a1c8-44390e3fb543%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/8bb121c7-2372-4419-86e7-993d9e992cd3%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/8bb121c7-2372-4419-86e7-993d9e992cd3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAEqaEVj-ouJ3drkPPHMC_VS_bwRzNegzF8niv3kFUz0w_55%2BnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to