Minor fixes

This commit is contained in:
Joshua Granick
2018-07-02 14:27:05 -07:00
parent b076f95dc7
commit 5528c9b88a
3 changed files with 35 additions and 38 deletions

View File

@@ -107,8 +107,8 @@ class HTML5Window {
setWidth = Reflect.hasField (attributes, "width") ? attributes.width : 0;
setHeight = Reflect.hasField (attributes, "height") ? attributes.height : 0;
parent.width = setWidth;
parent.height = setHeight;
parent.__width = setWidth;
parent.__height = setHeight;
parent.id = windowID++;
@@ -152,22 +152,22 @@ class HTML5Window {
}
if (parent.width == 0 && parent.height == 0) {
if (parent.__width == 0 && parent.__height == 0) {
if (element != null) {
parent.width = element.clientWidth;
parent.height = element.clientHeight;
parent.__width = element.clientWidth;
parent.__height = element.clientHeight;
} else {
parent.width = Browser.window.innerWidth;
parent.height = Browser.window.innerHeight;
parent.__width = Browser.window.innerWidth;
parent.__height = Browser.window.innerHeight;
}
cacheElementWidth = parent.width;
cacheElementHeight = parent.height;
cacheElementWidth = parent.__width;
cacheElementHeight = parent.__height;
resizeElement = true;
@@ -175,16 +175,16 @@ class HTML5Window {
if (canvas != null) {
canvas.width = Math.round (parent.width * scale);
canvas.height = Math.round (parent.height * scale);
canvas.width = Math.round (parent.__width * scale);
canvas.height = Math.round (parent.__height * scale);
canvas.style.width = parent.width + "px";
canvas.style.height = parent.height + "px";
canvas.style.width = parent.__width + "px";
canvas.style.height = parent.__height + "px";
} else {
div.style.width = parent.width + "px";
div.style.height = parent.height + "px";
div.style.width = parent.__width + "px";
div.style.height = parent.__height + "px";
}
@@ -582,8 +582,8 @@ class HTML5Window {
if (canvas != null) {
var rect = canvas.getBoundingClientRect ();
x = (event.clientX - rect.left) * (parent.width / rect.width);
y = (event.clientY - rect.top) * (parent.height / rect.height);
x = (event.clientX - rect.left) * (parent.__width / rect.width);
y = (event.clientY - rect.top) * (parent.__height / rect.height);
} else if (div != null) {
@@ -596,8 +596,8 @@ class HTML5Window {
} else {
var rect = element.getBoundingClientRect ();
x = (event.clientX - rect.left) * (parent.width / rect.width);
y = (event.clientY - rect.top) * (parent.height / rect.height);
x = (event.clientX - rect.left) * (parent.__width / rect.width);
y = (event.clientY - rect.top) * (parent.__height / rect.height);
}
@@ -1265,10 +1265,10 @@ class HTML5Window {
if (stretch) {
if (parent.width != elementWidth || parent.height != elementHeight) {
if (parent.__width != elementWidth || parent.__height != elementHeight) {
parent.width = elementWidth;
parent.height = elementHeight;
parent.__width = elementWidth;
parent.__height = elementHeight;
if (canvas != null) {

View File

@@ -554,7 +554,7 @@ class NativeWindow {
if (handle != null) {
#if (!macro && lime_cffi)
NativeCFFI.lime_application_set_frame_rate (handle, value);
NativeCFFI.lime_application_set_frame_rate (parent.application.__backend.handle, value);
#end
}

View File

@@ -57,6 +57,8 @@ class Preloader #if flash extends Sprite #end {
public function new () {
// TODO: Split out core preloader support from generic Preloader type
#if flash
super ();
#end
@@ -102,6 +104,15 @@ class Preloader #if flash extends Sprite #end {
};
#end
#if flash
Lib.current.addChild (this);
Lib.current.loaderInfo.addEventListener (flash.events.Event.COMPLETE, loaderInfo_onComplete);
Lib.current.loaderInfo.addEventListener (flash.events.Event.INIT, loaderInfo_onInit);
Lib.current.loaderInfo.addEventListener (ProgressEvent.PROGRESS, loaderInfo_onProgress);
Lib.current.addEventListener (flash.events.Event.ENTER_FRAME, current_onEnter);
#end
}
@@ -123,20 +134,6 @@ class Preloader #if flash extends Sprite #end {
}
public function create ():Void {
#if flash
Lib.current.addChild (this);
Lib.current.loaderInfo.addEventListener (flash.events.Event.COMPLETE, loaderInfo_onComplete);
Lib.current.loaderInfo.addEventListener (flash.events.Event.INIT, loaderInfo_onInit);
Lib.current.loaderInfo.addEventListener (ProgressEvent.PROGRESS, loaderInfo_onProgress);
Lib.current.addEventListener (flash.events.Event.ENTER_FRAME, current_onEnter);
#end
}
public function load ():Void {
for (library in libraries) {
@@ -336,7 +333,7 @@ class Preloader #if flash extends Sprite #end {
});
}
}
}