Skip to content

Commit 7893080

Browse files
authored
Merge pull request #21 from elnabo/master
Title compability
2 parents 36faffb + be17953 commit 7893080

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

haxe/ui/backend/ScreenBase.hx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ class ScreenBase {
5454
return HtmlUtils.dpi;
5555
}
5656

57+
public var title(get,set):String;
58+
private inline function get_title():String {
59+
return js.Browser.document.title;
60+
}
61+
private inline function set_title(s:String):String {
62+
js.Browser.document.title = s;
63+
return s;
64+
}
65+
5766
private var __topLevelComponents:Array<Component> = [];
5867
public function addComponent(component:Component) {
5968
container.appendChild(component.element);
@@ -154,37 +163,37 @@ class ScreenBase {
154163
case MouseEvent.MOUSE_MOVE | MouseEvent.MOUSE_OVER | MouseEvent.MOUSE_OUT |
155164
MouseEvent.MOUSE_DOWN | MouseEvent.MOUSE_UP | MouseEvent.CLICK:
156165

157-
// chrome sends a spurious mouse move event even if the mouse hasnt moved, lets consume that first
166+
// chrome sends a spurious mouse move event even if the mouse hasnt moved, lets consume that first
158167
if (type == MouseEvent.MOUSE_MOVE && _mapping.exists(type) == false && UserAgent.instance.chrome == true) {
159168
var fn = null;
160169
fn = function(e) {
161170
container.removeEventListener(EventMapper.HAXEUI_TO_DOM.get(MouseEvent.MOUSE_MOVE), fn);
162171
if (EventMapper.MOUSE_TO_TOUCH.get(type) != null) {
163172
container.removeEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), fn);
164173
}
165-
174+
166175
if (_mapping.exists(type) == false) {
167176
if (EventMapper.MOUSE_TO_TOUCH.get(type) != null) {
168177
container.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent);
169178
}
170-
179+
171180
_mapping.set(type, listener);
172181
container.addEventListener(EventMapper.HAXEUI_TO_DOM.get(MouseEvent.MOUSE_MOVE), __onMouseEvent);
173182
}
174183
}
175-
184+
176185
container.addEventListener(EventMapper.HAXEUI_TO_DOM.get(MouseEvent.MOUSE_MOVE), fn);
177186
if (EventMapper.MOUSE_TO_TOUCH.get(type) != null) {
178187
container.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), fn);
179188
}
180189
return;
181190
}
182-
191+
183192
if (_mapping.exists(type) == false) {
184193
if (EventMapper.MOUSE_TO_TOUCH.get(type) != null) {
185194
container.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent);
186195
}
187-
196+
188197
_mapping.set(type, listener);
189198
container.addEventListener(EventMapper.HAXEUI_TO_DOM.get(type), __onMouseEvent);
190199
}
@@ -225,12 +234,12 @@ class ScreenBase {
225234
if (fn != null) {
226235
var mouseEvent = new MouseEvent(type);
227236
mouseEvent._originalEvent = event;
228-
237+
229238
var touchEvent = false;
230239
try {
231240
touchEvent = Std.is(event, js.html.TouchEvent);
232241
} catch (e:Dynamic) { }
233-
242+
234243
if (touchEvent == true) {
235244
var te:js.html.TouchEvent = cast(event, js.html.TouchEvent);
236245
mouseEvent.screenX = te.changedTouches[0].pageX / Toolkit.scaleX;
@@ -242,7 +251,7 @@ class ScreenBase {
242251
mouseEvent.screenX = me.pageX / Toolkit.scaleX;
243252
mouseEvent.screenY = me.pageY / Toolkit.scaleY;
244253
}
245-
254+
246255
fn(mouseEvent);
247256
}
248257
}
@@ -261,4 +270,4 @@ class ScreenBase {
261270
}
262271
}
263272
}
264-
}
273+
}

0 commit comments

Comments
 (0)