Skip to content

Commit

Permalink
Merge pull request #55 from doki-theme/stickerFix
Browse files Browse the repository at this point in the history
Zoom Scroll Fix
  • Loading branch information
Unthrottled authored Jan 26, 2023
2 parents ee024fd + 634a493 commit 872a1cc
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
---

# 88.3-1.0.3 [Zoom Scroll Fix]

- Added **StickerRelativeSize** options to the content settings. Which fixes the sticker's size in place while you zoom scroll. See documentation for more details.
- Preventing invalid inputs for the **WallpaperOpacity** setting.
- Renamed extensiot to `Doki Theme` & updated the extension logo to the most current.

# 88.1-1.0.2 [Darling]

Best Girl just got _better_. ❤️
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ You can navigate to the settings here
That's why I've allowed you to set your own custom sticker to be used for all doki themes.
The value provided _must_ be an absolute path to the local file on your machine to be used. Feel free to use the `...` to pick a file.

**StickerRelativeSize** because I do not know the Visual Studio SDK very well, this is my solution to fixing issues with zoom scrolling. When the viewport size changes, the sticker would either grow or shrink relative to the viewport. This is the relative size the sticker should be relative to the current view port. 1 being the same size as the viewport and 0.01 being 1 percent the size of the current viewport.

**Note**: stickers go away if you use a non-Doki Theme.

### Wallpapers
Expand Down
22 changes: 21 additions & 1 deletion doki-theme-visualstudio/DokiThemeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public double WallpaperOpacity {
}
}

public double StickerRelativeSize {
get {
var page = (DokiThemeSettings)_package.GetDialogPage(typeof(DokiThemeSettings));
return page.StickerRelativeSize;
}
}

public double WallpaperOffsetX {
get {
var page = (DokiThemeSettings)_package.GetDialogPage(typeof(DokiThemeSettings));
Expand Down Expand Up @@ -164,7 +171,20 @@ public bool DrawWallpaper {
[EditorAttribute(typeof(BrowseFile), typeof(UITypeEditor))]
public double WallpaperOpacity {
get { return _wallpaperOpacity; }
set { _wallpaperOpacity = value; }
set {
var usableOpacity = value < 0 ? -1 : Math.Min(value, 1);
_wallpaperOpacity = usableOpacity;
}
}

private double _StickerRelativeSize = 0.2;

[DescriptionAttribute("How big should the sticker be relative to your current viewport?")]
[EditorAttribute(typeof(BrowseFile), typeof(UITypeEditor))]
public double StickerRelativeSize
{
get { return _StickerRelativeSize; }
set { _StickerRelativeSize = value; }
}

private BackgroundSize _wallpaperFill = BackgroundSize.Filled;
Expand Down
2 changes: 1 addition & 1 deletion doki-theme-visualstudio/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 Alex Simons
Copyright (c) 2023 Alex Simons

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions doki-theme-visualstudio/StickerAdornment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ internal sealed class StickerAdornment {

private bool _registeredLayoutListener;

private double _stickerSize = 0.2;

public StickerAdornment(IWpfTextView view) {
_view = view ?? throw new ArgumentNullException(nameof(view));

Expand All @@ -43,8 +45,11 @@ public StickerAdornment(IWpfTextView view) {
} else {
RemoveStickerStuff();
}
_stickerSize = service.StickerRelativeSize;
};

_stickerSize = SettingsService.Instance.StickerRelativeSize;

if (!SettingsService.Instance.DrawSticker) return;

DrawCurrentSticker();
Expand Down Expand Up @@ -142,6 +147,13 @@ private void DrawImage() {

RemoveAdornment();


var aspectRatio = _image.Width / _image.Height;
var usableWidth = _view.ViewportWidth * _stickerSize;
var usableHeight = usableWidth * aspectRatio;
_image.Width = usableWidth;
_image.Height = usableHeight;

// place in lower right hand corner
Canvas.SetLeft(_image, _view.ViewportRight - _image.ActualWidth);
Canvas.SetTop(_image, _view.ViewportBottom - _image.ActualHeight);
Expand Down
Binary file modified doki-theme-visualstudio/doki_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doki-theme-visualstudio/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="doki_theme_visualstudio.59d36e38-60e0-4571-9901-7971ec61b303" Version="88.1.2" Language="en-US" Publisher="Unthrottled" />
<DisplayName>The Doki Theme</DisplayName>
<Identity Id="doki_theme_visualstudio.59d36e38-60e0-4571-9901-7971ec61b303" Version="88.1.3" Language="en-US" Publisher="Unthrottled" />
<DisplayName>Doki Theme</DisplayName>
<Description xml:space="preserve">Cute anime character themes!</Description>
<MoreInfo>https://github.com/doki-theme/doki-theme-visualstudio#the-doki-theme-visual-studio</MoreInfo>
<License>LICENSE.txt</License>
Expand Down

0 comments on commit 872a1cc

Please sign in to comment.