Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implemented wpf shadow #998

Merged
merged 3 commits into from Feb 10, 2017
Merged

Re-implemented wpf shadow #998

merged 3 commits into from Feb 10, 2017

Conversation

kevinvangelder
Copy link
Contributor

UWP implementation will have to be totally different, but for now this addresses the WPF side of #953

@kevinvangelder
Copy link
Contributor Author

shadow

@kevinvangelder
Copy link
Contributor Author

Bonus: automatically works with transparent images:
shadow2

[ReactProp(ViewProps.ShadowColor, CustomType = "Color")]
public void SetShadowColor(TFrameworkElement view, uint? color)
{
DropShadowEffect effect = (DropShadowEffect)view.Effect ?? new DropShadowEffect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var

[ReactProp(ViewProps.ShadowOpacity)]
public void SetShadowOpacity(TFrameworkElement view, double opacity)
{
DropShadowEffect effect = (DropShadowEffect)view.Effect ?? new DropShadowEffect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var

[ReactProp(ViewProps.ShadowRadius)]
public void SetShadowRadius(TFrameworkElement view, double radius)
{
DropShadowEffect effect = (DropShadowEffect)view.Effect ?? new DropShadowEffect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var

[ReactProp(ViewProps.ShadowOffset)]
public void SetShadowOffset(TFrameworkElement view, JObject offset)
{
DropShadowEffect effect = (DropShadowEffect)view.Effect ?? new DropShadowEffect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var

DropShadowEffect effect = (DropShadowEffect)view.Effect ?? new DropShadowEffect();
var deltaX = offset.Value<double>("width");
var deltaY = offset.Value<double>("height");
var angle = Math.Atan2(deltaY, deltaX) * (180 / Math.PI);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

180 [](start = 54, length = 3)

I'm pretty sure this returns a double anyway, but it may make sense to use 180.

@@ -84,6 +84,11 @@ public static class ViewProps
public const string BorderBottomLeftRadius = "borderBottomLeftRadius";
public const string BorderBottomRightRadius = "borderBottomRightRadius";

public const string ShadowColor = "shadowColor";
public const string ShadowOffset = "shadowOffset";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just inline the strings? I try to keep tis file in sync with https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java. I should have put a comment along those lines in here.

@rozele rozele merged commit c266aa4 into microsoft:master Feb 10, 2017
rozele pushed a commit that referenced this pull request Feb 10, 2017
* re-implemented wpf shadow

* Addressing minor comments from review.
rozele pushed a commit that referenced this pull request Feb 15, 2017
* re-implemented wpf shadow

* Addressing minor comments from review.
rozele pushed a commit that referenced this pull request Feb 15, 2017
* re-implemented wpf shadow

* Addressing minor comments from review.
@matthargett matthargett deleted the shadow-wpf branch April 6, 2017 18:24
@anhdevit
Copy link

It not working

@kevinvangelder
Copy link
Contributor Author

This is very outdated code, I wouldn't expect it to work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants