mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Set initial location correctly.
This commit is contained in:
parent
6f86acf712
commit
e83704982f
2 changed files with 14 additions and 9 deletions
|
@ -332,14 +332,15 @@ void VenuesController::rowPaintIcon(
|
|||
p.drawImage(x, y, data.image);
|
||||
}
|
||||
|
||||
[[nodiscard]] QByteArray DefaultCenter() {
|
||||
if (!LastExactLocation) {
|
||||
[[nodiscard]] QByteArray DefaultCenter(Core::GeoLocation initial) {
|
||||
const auto &use = initial.exact() ? initial : LastExactLocation;
|
||||
if (!use) {
|
||||
return "null";
|
||||
}
|
||||
return "["_q
|
||||
+ QByteArray::number(LastExactLocation.point.x())
|
||||
+ QByteArray::number(use.point.x())
|
||||
+ ","_q
|
||||
+ QByteArray::number(LastExactLocation.point.y())
|
||||
+ QByteArray::number(use.point.y())
|
||||
+ "]"_q;
|
||||
}
|
||||
|
||||
|
@ -496,6 +497,10 @@ void VenuesController::rowPaintIcon(
|
|||
status->moveToLeft(statusPosition.x(), statusPosition.y(), width);
|
||||
}, name->lifetime());
|
||||
|
||||
icon->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
name->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
status->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -681,9 +686,9 @@ void LocationPicker::setup(const Descriptor &descriptor) {
|
|||
setupWindow(descriptor);
|
||||
setupWebview(descriptor);
|
||||
|
||||
_initialProvided = descriptor.initial.exact();
|
||||
const auto initial = _initialProvided
|
||||
? descriptor.initial
|
||||
_initialProvided = descriptor.initial;
|
||||
const auto initial = _initialProvided.exact()
|
||||
? _initialProvided
|
||||
: LastExactLocation;
|
||||
if (initial) {
|
||||
venuesRequest(initial);
|
||||
|
@ -964,7 +969,7 @@ void LocationPicker::mapReady() {
|
|||
Expects(_scroll != nullptr);
|
||||
|
||||
const auto token = _config.mapsToken.toUtf8();
|
||||
const auto center = DefaultCenter();
|
||||
const auto center = DefaultCenter(_initialProvided);
|
||||
const auto bounds = DefaultBounds();
|
||||
const auto protocol = *kProtocolOverride
|
||||
? "'"_q + kProtocolOverride + "'"
|
||||
|
|
|
@ -133,8 +133,8 @@ private:
|
|||
ScrollArea *_scroll = nullptr;
|
||||
std::unique_ptr<Webview::Window> _webview;
|
||||
SingleQueuedInvokation _updateStyles;
|
||||
Core::GeoLocation _initialProvided;
|
||||
bool _subscribedToColors = false;
|
||||
bool _initialProvided = false;
|
||||
|
||||
base::Timer _geocoderResolveTimer;
|
||||
Core::GeoLocation _geocoderResolvePostponed;
|
||||
|
|
Loading…
Add table
Reference in a new issue