Skip to content

Commit

Permalink
dom: Win.devicePixelRatio
Browse files Browse the repository at this point in the history
  • Loading branch information
briansfrank committed Dec 30, 2024
1 parent 7144c4a commit fed3f87
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/doc/docIntro/doc/ChangeLog.fandoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
** license: Licensed under the Academic Free License version 3.0
**************************************************************************

*Build 1.0.82 (working)*
- Win.devicePixelRatio

*Build 1.0.81 (6 Dec 2024)*
- New markdown pod
- New util::Console API
Expand Down
5 changes: 3 additions & 2 deletions src/dom/es/CanvasGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class CanvasGraphics extends sys.Obj {
}

// This drawEllipse(Float x, Float y, Float w, Float h)
drawEllipsefunction(x, y, w, h)
drawEllipse(x, y, w, h)
{
this.pathEllipse(x, y, w, h);
this.cx.stroke();
Expand Down Expand Up @@ -273,4 +273,5 @@ class CanvasGraphics extends sys.Obj {
// state for fields in push/pop
#stack = new Array();

}
}

8 changes: 7 additions & 1 deletion src/dom/es/WinPeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ class WinPeer extends sys.Obj {
return this.#screenSize;
}

devicePixelRatio(self)
{
return sys.Float.make(this.win.devicePixelRatio);
}

#parent;
parent(self)
{
Expand Down Expand Up @@ -457,4 +462,5 @@ class WinPeer extends sys.Obj {

return map;
}
}
}

6 changes: 5 additions & 1 deletion src/dom/fan/Win.fan
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class Win
** Return the size of the screen in pixels.
native Size screenSize()

** Ratio of physical pixels to the resolution in CSS pixels
native Float devicePixelRatio()

** Returns a reference to the parent of the current window
** or subframe, or null if this is the top-most window.
native Win? parent()
Expand Down Expand Up @@ -255,4 +258,5 @@ class Win
** Poll for a browser dependent map of diagnostics name/value pairs
** for current state of JsVM and DOM.
@NoDoc native Str:Obj diagnostics()
}
}

8 changes: 7 additions & 1 deletion src/dom/js/WinPeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ fan.dom.WinPeer.prototype.screenSize = function(self)
return this.$screenSize;
}

fan.dom.WinPeer.prototype.devicePixelRatio = function(self)
{
return fan.sys.Float.make(this.win.devicePixelRatio);
}

fan.dom.WinPeer.prototype.parent = function(self)
{
if (this.win == this.win.parent) return null;
Expand Down Expand Up @@ -452,4 +457,5 @@ fan.dom.WinPeer.prototype.diagnostics = function(self)
map.set("perf.timing.load", dur(t.loadEventStart, t.loadEventEnd));

return map;
}
}

0 comments on commit fed3f87

Please sign in to comment.