mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Merge remote-tracking branch 'upstream/main' into main
This commit is contained in:
@@ -292,19 +292,41 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var swipeMarkReadImage: RSImage = {
|
||||
return RSImage(named: "swipeMarkRead")!
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
// TODO: remove swipeMarkRead asset when dropping support for macOS 10.15
|
||||
return RSImage(named: "swipeMarkRead")!
|
||||
}
|
||||
}()
|
||||
|
||||
static var swipeMarkUnreadImage: RSImage = {
|
||||
return RSImage(named: "swipeMarkUnread")!
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
// TODO: remove swipeMarkUnread asset when dropping support for macOS 10.15
|
||||
return RSImage(named: "swipeMarkUnread")!
|
||||
}
|
||||
}()
|
||||
|
||||
static var swipeMarkStarredImage: RSImage = {
|
||||
return RSImage(named: "swipeMarkStarred")!
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
return RSImage(named: "swipeMarkStarred")!
|
||||
}
|
||||
}()
|
||||
|
||||
static var swipeMarkUnstarredImage: RSImage = {
|
||||
return RSImage(named: "swipeMarkUnstarred")!
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
return RSImage(named: "swipeMarkUnstarred")!
|
||||
}
|
||||
}()
|
||||
|
||||
static var starColor: NSColor = {
|
||||
|
||||
@@ -941,7 +941,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
|
||||
switch edge {
|
||||
case .leading:
|
||||
let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.read ? "Unread" : "Read") { (action, row) in
|
||||
self.toggleArticleRead(article);
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
@@ -949,7 +949,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
return [action]
|
||||
|
||||
case .trailing:
|
||||
let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.starred ? "Unstar" : "Star") { (action, row) in
|
||||
self.toggleArticleStarred(article);
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
|
||||
@@ -35,11 +35,21 @@ class ImageViewer {
|
||||
|
||||
var canvas = document.createElement("canvas");
|
||||
var pixelRatio = window.devicePixelRatio;
|
||||
var totalPixels = 0;
|
||||
do {
|
||||
canvas.width = this.img.naturalWidth * pixelRatio;
|
||||
canvas.height = this.img.naturalHeight * pixelRatio;
|
||||
totalPixels = canvas.width * canvas.height;
|
||||
pixelRatio--;
|
||||
} while (pixelRatio > 0 && canvas.width * canvas.height > 16777216)
|
||||
} while (pixelRatio > 0 && totalPixels > 16777216)
|
||||
|
||||
// If the totalPixels is still too big to draw on a canvas, scale it down
|
||||
if (totalPixels > 16777216) {
|
||||
var adjustment = 1 - ((totalPixels - 16777216) / totalPixels);
|
||||
canvas.width = canvas.width * adjustment;
|
||||
canvas.height = canvas.height * adjustment;
|
||||
}
|
||||
|
||||
canvas.getContext("2d").drawImage(this.img, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
const rect = this.img.getBoundingClientRect();
|
||||
|
||||
Reference in New Issue
Block a user