Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
59870574
Commit
59870574
authored
Oct 19, 2018
by
Mark Sherman
Committed by
Jeffrey Schiller
Oct 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sidebar tutorial images now scale to fit the window. (#1209)
parent
61ae55dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/TutorialPanel.java
...appinventor/client/editor/youngandroid/TutorialPanel.java
+20
-1
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/TutorialPanel.java
View file @
59870574
...
@@ -8,6 +8,7 @@ package com.google.appinventor.client.editor.youngandroid;
...
@@ -8,6 +8,7 @@ package com.google.appinventor.client.editor.youngandroid;
import
com.google.gwt.event.dom.client.LoadEvent
;
import
com.google.gwt.event.dom.client.LoadEvent
;
import
com.google.gwt.event.dom.client.LoadHandler
;
import
com.google.gwt.event.dom.client.LoadHandler
;
import
com.google.gwt.user.client.Window
;
import
com.google.gwt.user.client.ui.Button
;
import
com.google.gwt.user.client.ui.Button
;
import
com.google.gwt.user.client.ui.ClickListener
;
import
com.google.gwt.user.client.ui.ClickListener
;
import
com.google.gwt.user.client.ui.DialogBox
;
import
com.google.gwt.user.client.ui.DialogBox
;
...
@@ -74,9 +75,27 @@ public class TutorialPanel extends Frame {
...
@@ -74,9 +75,27 @@ public class TutorialPanel extends Frame {
ok
.
setStyleName
(
"DialogBox-button"
);
ok
.
setStyleName
(
"DialogBox-button"
);
// Adds Image
// Adds Image
Image
image
=
new
Image
(
img
);
final
Image
image
=
new
Image
(
img
);
image
.
addLoadHandler
(
new
LoadHandler
()
{
image
.
addLoadHandler
(
new
LoadHandler
()
{
public
void
onLoad
(
LoadEvent
evt
)
{
public
void
onLoad
(
LoadEvent
evt
)
{
final
int
imageWidth
=
image
.
getWidth
();
final
int
imageHeight
=
image
.
getHeight
();
final
int
windowWidth
=
(
int
)
((
float
)
Window
.
getClientWidth
()
*
0.8
);
final
int
windowHeight
=
(
int
)
((
float
)
Window
.
getClientHeight
()
*
0.9
);
int
effectiveWidth
=
imageWidth
;
int
effectiveHeight
=
imageHeight
;
if
(
imageWidth
>
windowWidth
)
{
effectiveWidth
=
windowWidth
;
effectiveHeight
=
(
int
)(
imageHeight
*
((
float
)
effectiveWidth
/
imageWidth
));
}
if
(
effectiveHeight
>
windowHeight
)
{
effectiveHeight
=
windowHeight
;
effectiveWidth
=
(
int
)(
imageWidth
*
((
float
)
effectiveHeight
/
imageHeight
));
}
image
.
setPixelSize
(
effectiveWidth
,
effectiveHeight
);
dialogBox
.
center
();
dialogBox
.
center
();
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment