|
@@ -122,6 +122,7 @@ Type
|
|
|
FTimerInterval: NativeInt;
|
|
|
FLastTick: TDateTime;
|
|
|
FKeyMap : TJSObject;
|
|
|
+ procedure DoGlobalClick(aEvent: TJSEvent);
|
|
|
procedure DrawBaseLine(C: TJSCanvasRenderingContext2D; S: String; X, Y: Single);
|
|
|
procedure SetCreateDefaultCanvas(AValue: Boolean);
|
|
|
procedure SetFocusedCanvas(AValue: TCanvasReference);
|
|
@@ -366,7 +367,6 @@ procedure TCanvasReference.SetFillStyle(AValue: JSValue);
|
|
|
begin
|
|
|
if FFillStyle=AValue then Exit;
|
|
|
FFillStyle:=AValue;
|
|
|
- Writeln('---> Canvas: fill style ',FFillStyle);
|
|
|
canvascontext.fillStyle:=FFillStyle;
|
|
|
end;
|
|
|
|
|
@@ -587,6 +587,7 @@ begin
|
|
|
Result:=True;
|
|
|
TJSArray(API.FEvents).Push(MouseToEvent(evt,WASMSG_CLICK));
|
|
|
SendEvent;
|
|
|
+ aEvent.cancelBubble:=True;
|
|
|
end;
|
|
|
|
|
|
function TCanvasReference.DoMouseDblClick(aEvent: TJSEvent): boolean;
|
|
@@ -623,11 +624,28 @@ begin
|
|
|
InstallGLobalHandlers;
|
|
|
end;
|
|
|
|
|
|
+procedure TWasmFresnelApi.DoGlobalClick(aEvent : TJSEvent);
|
|
|
+
|
|
|
+var
|
|
|
+ EL : TJSElement;
|
|
|
+
|
|
|
+begin
|
|
|
+ El:=aEvent.targetElement;
|
|
|
+ While Assigned(El) do
|
|
|
+ begin
|
|
|
+ if El.ClassList.contains('fresnel-window') then
|
|
|
+ exit;
|
|
|
+ El:=El.parentElement;
|
|
|
+ end;
|
|
|
+ FocusedCanvas:=Nil;
|
|
|
+end;
|
|
|
+
|
|
|
procedure TWasmFresnelApi.InstallGlobalHandlers;
|
|
|
begin
|
|
|
// Attach to summary
|
|
|
Document.Body.AddEventListener('keydown',@DoKeyDownEvent);
|
|
|
Document.Body.AddEventListener('keyup',@DoKeyUpEvent);
|
|
|
+ Document.Body.AddEventListener('click',@DoGlobalClick);
|
|
|
end;
|
|
|
|
|
|
function TWasmFresnelApi.ImportName: String;
|
|
@@ -771,7 +789,7 @@ begin
|
|
|
if lMap=Nil then
|
|
|
lmap:=GetGlobalKeyMap;
|
|
|
Result:=KeyNameToKeyCode(lMap,aKey);
|
|
|
- Writeln('Mapped ',aKey,' to ',TJSJSON.StringIfy(Result));
|
|
|
+// Writeln('Mapped ',aKey,' to ',TJSJSON.StringIfy(Result));
|
|
|
end;
|
|
|
|
|
|
class function TWasmFresnelApi.KeyNameToKeyCode(aMap : TJSObject; aKey: string): TKeyKind;
|
|
@@ -2025,7 +2043,6 @@ begin
|
|
|
C:=GetCanvas(aID);
|
|
|
if Assigned(C) then
|
|
|
begin
|
|
|
- Console.Log('Drawing rect, current fill style: ',C.fillStyle);
|
|
|
C.FillRect(X,y,width,Height);
|
|
|
Result:=ECANVAS_SUCCESS;
|
|
|
end;
|