Skip to content

Commit

Permalink
Merge branch 'asthomas-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
BSick7 committed Jan 15, 2016
2 parents ebb51a1 + 8113cd4 commit 4ac5205
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 19 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
## 0.19.10 (December 14, 2015)
## 0.19.13 (Jan 14, 2016)

BUG FIXES:
FEATURES

* controls: Add Watermark to ComboBox. [GH-229]
* brush: Add conversion from SolidColorBrush to Color. [GH-232]

SAFETY

* brush: Force gradient color stops into [0.0, 1.0] range. [GH-232]

## 0.19.12 (Jan 4, 2016)

SAFETY

* markup: Report FrameworkTemplate syntax errors. [GH-227]

## 0.19.11 (Dec 21, 2015)

FEATURES

* navigation: ViewModelProvider can redirect to another route. [GH-215]

## 0.19.10 (Dec 14, 2015)

BUG FIXES

* compatibility: Scrollbars appearing in Edge, Firefox. [GH-202]
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fayde",
"version": "0.19.12",
"version": "0.19.13",
"main": "dist/fayde.js",
"homepage": "http://fayde.wsick.com",
"authors": [
Expand Down
5 changes: 5 additions & 0 deletions dist/fayde.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,15 +1552,18 @@ declare module Fayde.Controls {
static ItemContainerStyleProperty: DependencyProperty;
static MaxDropDownHeightProperty: DependencyProperty;
static IsSelectionActiveProperty: DependencyProperty;
static WatermarkProperty: DependencyProperty;
IsDropDownOpen: boolean;
ItemContainerStyle: Style;
MaxDropDownHeight: number;
Watermark: String;
private $ContentPresenter;
private $Popup;
private $DropDownToggle;
private $DisplayedItem;
private $SelectionBoxItem;
private $SelectionBoxItemTemplate;
private $WatermarkElement;
private _NullSelFallback;
private _FocusedIndex;
constructor();
Expand All @@ -1578,6 +1581,7 @@ declare module Fayde.Controls {
OnMouseEnter(e: Input.MouseEventArgs): void;
OnMouseLeave(e: Input.MouseEventArgs): void;
OnKeyDown(e: Input.KeyEventArgs): void;
private _CheckWatermarkVisibility();
OnGotFocus(e: RoutedEventArgs): void;
OnLostFocus(e: RoutedEventArgs): void;
private _OnChildKeyDown(sender, e);
Expand Down Expand Up @@ -3774,6 +3778,7 @@ declare module Fayde.Media {
CreatePad(ctx: CanvasRenderingContext2D, bounds: minerva.Rect): void;
CreateRepeat(ctx: CanvasRenderingContext2D, bounds: minerva.Rect): void;
CreateReflect(ctx: CanvasRenderingContext2D, bounds: minerva.Rect): void;
AddColorStop(grd: any, offset: number, color: string): void;
}
}
declare module Fayde.Media {
Expand Down
29 changes: 23 additions & 6 deletions dist/fayde.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Fayde;
(function (Fayde) {
Fayde.version = '0.19.12';
Fayde.version = '0.19.13';
})(Fayde || (Fayde = {}));
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
Expand Down Expand Up @@ -6001,6 +6001,7 @@ var Fayde;
var selectedItem = this.SelectedItem;
this._UpdateDisplayedItem(open && selectedItem instanceof Fayde.UIElement ? null : selectedItem);
this.UpdateVisualState(true);
this._CheckWatermarkVisibility();
};
ComboBox.prototype._MaxDropDownHeightChanged = function (args) {
this._UpdatePopupMaxHeight(args.NewValue);
Expand All @@ -6016,6 +6017,7 @@ var Fayde;
this.$ContentPresenter = this._GetChildOfType("ContentPresenter", Controls.ContentPresenter);
this.$Popup = this._GetChildOfType("Popup", Controls.Primitives.Popup);
this.$DropDownToggle = this._GetChildOfType("DropDownToggle", Controls.Primitives.ToggleButton);
this.$WatermarkElement = this.GetTemplateChild("WatermarkElement", Fayde.FrameworkElement);
if (this.$ContentPresenter != null)
this._NullSelFallback = this.$ContentPresenter.Content;
if (this.$Popup != null) {
Expand Down Expand Up @@ -6142,6 +6144,10 @@ var Fayde;
break;
}
};
ComboBox.prototype._CheckWatermarkVisibility = function () {
if (this.Watermark.length > 0 && this.$WatermarkElement)
this.$WatermarkElement.Visibility = this.$SelectionBoxItem != null ? Fayde.Visibility.Collapsed : Fayde.Visibility.Visible;
};
ComboBox.prototype.OnGotFocus = function (e) {
_super.prototype.OnGotFocus.call(this, e);
this.UpdateVisualState(true);
Expand All @@ -6157,6 +6163,7 @@ var Fayde;
ComboBox.prototype.OnSelectionChanged = function (e) {
if (!this.IsDropDownOpen)
this._UpdateDisplayedItem(this.SelectedItem);
this._CheckWatermarkVisibility();
};
ComboBox.prototype._OnToggleChecked = function (sender, e) { this.IsDropDownOpen = true; };
ComboBox.prototype._OnToggleUnchecked = function (sender, e) { this.IsDropDownOpen = false; };
Expand Down Expand Up @@ -6279,11 +6286,12 @@ var Fayde;
ComboBox.ItemContainerStyleProperty = DependencyProperty.Register("ItemContainerStyle", function () { return Fayde.Style; }, ComboBox, undefined, function (d, args) { return d.OnItemContainerStyleChanged(args); });
ComboBox.MaxDropDownHeightProperty = DependencyProperty.Register("MaxDropDownHeight", function () { return Number; }, ComboBox, Number.POSITIVE_INFINITY, function (d, args) { return d._MaxDropDownHeightChanged(args); });
ComboBox.IsSelectionActiveProperty = Controls.Primitives.Selector.IsSelectionActiveProperty;
ComboBox.WatermarkProperty = DependencyProperty.Register("Watermark", function () { return String; }, ComboBox, "");
return ComboBox;
})(Controls.Primitives.Selector);
Controls.ComboBox = ComboBox;
Fayde.CoreLibrary.add(ComboBox);
Controls.TemplateParts(ComboBox, { Name: "ContentPresenter", Type: Controls.ContentPresenter }, { Name: "Popup", Type: Controls.Primitives.Popup }, { Name: "ContentPresenterBorder", Type: Fayde.FrameworkElement }, { Name: "DropDownToggle", Type: Controls.Primitives.ToggleButton }, { Name: "ScrollViewer", Type: Controls.ScrollViewer });
Controls.TemplateParts(ComboBox, { Name: "ContentPresenter", Type: Controls.ContentPresenter }, { Name: "Popup", Type: Controls.Primitives.Popup }, { Name: "ContentPresenterBorder", Type: Fayde.FrameworkElement }, { Name: "DropDownToggle", Type: Controls.Primitives.ToggleButton }, { Name: "ScrollViewer", Type: Controls.ScrollViewer }, { Name: "WatermarkElement", Type: Fayde.FrameworkElement });
Controls.TemplateVisualStates(ComboBox, { GroupName: "CommonStates", Name: "Normal" }, { GroupName: "CommonStates", Name: "MouseOver" }, { GroupName: "CommonStates", Name: "Disabled" }, { GroupName: "FocusStates", Name: "Unfocused" }, { GroupName: "FocusStates", Name: "Focused" }, { GroupName: "FocusStates", Name: "FocusedDropDown" }, { GroupName: "ValidationStates", Name: "Valid" }, { GroupName: "ValidationStates", Name: "InvalidUnfocused" }, { GroupName: "ValidationStates", Name: "InvalidFocused" });
})(Controls = Fayde.Controls || (Fayde.Controls = {}));
})(Fayde || (Fayde = {}));
Expand Down Expand Up @@ -16865,6 +16873,13 @@ var Fayde;
GradientBrush.prototype.CreatePad = function (ctx, bounds) { };
GradientBrush.prototype.CreateRepeat = function (ctx, bounds) { };
GradientBrush.prototype.CreateReflect = function (ctx, bounds) { };
GradientBrush.prototype.AddColorStop = function (grd, offset, color) {
if (offset < 0.0)
offset = 0.0;
if (offset > 1.0)
offset = 1.0;
grd.addColorStop(offset, color);
};
GradientBrush.GradientStopsProperty = DependencyProperty.RegisterImmutable("GradientStops", function () { return Media.GradientStopCollection; }, GradientBrush);
GradientBrush.MappingModeProperty = DependencyProperty.Register("MappingMode", function () { return new Fayde.Enum(Media.BrushMappingMode); }, GradientBrush, Media.BrushMappingMode.RelativeToBoundingBox, function (d, args) { return d.InvalidateBrush(); });
GradientBrush.SpreadMethodProperty = DependencyProperty.Register("SpreadMethod", function () { return new Fayde.Enum(Media.GradientSpreadMethod); }, GradientBrush, Media.GradientSpreadMethod.Pad, function (d, args) { return d.InvalidateBrush(); });
Expand Down Expand Up @@ -16983,7 +16998,7 @@ var Fayde;
var grd = ctx.createLinearGradient(data.start.x, data.start.y, data.end.x, data.end.y);
for (var en = this.GradientStops.getEnumerator(); en.moveNext();) {
var stop = en.current;
grd.addColorStop(stop.Offset, stop.Color.toString());
this.AddColorStop(grd, stop.Offset, stop.Color.toString());
}
return grd;
};
Expand All @@ -17003,7 +17018,7 @@ var Fayde;
var stop = en.current;
var offset = interpolator.interpolate(stop.Offset);
if (offset >= 0 && offset <= 1)
grd.addColorStop(offset, stop.Color.toString());
this.AddColorStop(grd, offset, stop.Color.toString());
}
}
return grd;
Expand Down Expand Up @@ -18249,7 +18264,7 @@ var Fayde;
var grd = (!data.balanced ? tmpCtx : ctx).createRadialGradient(data.x0, data.y0, 0, data.x1, data.y1, data.r1);
for (var en = this.GradientStops.getEnumerator(); en.moveNext();) {
var stop = en.current;
grd.addColorStop(stop.Offset, stop.Color.toString());
this.AddColorStop(grd, stop.Offset, stop.Color.toString());
}
return this.FitPattern(ctx, grd, data, bounds);
};
Expand All @@ -18276,7 +18291,7 @@ var Fayde;
var offset = en.current.Offset;
if (reflect && inverted)
offset = 1 - offset;
grd.addColorStop(offset, en.current.Color.toString());
this.AddColorStop(grd, offset, en.current.Color.toString());
}
tmpCtx.fillStyle = grd;
tmpCtx.beginPath();
Expand Down Expand Up @@ -19418,6 +19433,8 @@ Fayde.CoreLibrary.addPrimitive(Color);
nullstone.registerTypeConverter(Color, function (val) {
if (!val || val instanceof Color)
return val;
if (val instanceof Fayde.Media.SolidColorBrush)
return val.Color;
val = val.toString();
if (val[0] !== "#") {
var color = Color.KnownColors[val];
Expand Down
2 changes: 1 addition & 1 deletion dist/fayde.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fayde",
"version": "0.19.12",
"version": "0.19.13",
"description": "Cross-platform/cross-browser XAML framework",
"main": "Gruntfile.js",
"directories": {
Expand Down
16 changes: 15 additions & 1 deletion src/Media/GradientBrush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,21 @@ module Fayde.Media {
CreatePad(ctx: CanvasRenderingContext2D, bounds: minerva.Rect) { }
CreateRepeat(ctx: CanvasRenderingContext2D, bounds: minerva.Rect) { }
CreateReflect(ctx: CanvasRenderingContext2D, bounds: minerva.Rect) { }

/**
* In Silverlight gradient offsets can be outside the range 0..1, but
* in HTML5 they cannot. Ensure that the gradient offsets are in range
* even at the expense of differences in rendering between Silverlight
* and Fayde. Without this, an attempt to set an out-of-range offset
* will cause an exception and you get no rendering at all.
*/
public AddColorStop(grd : any, offset : number, color : string)
{
if (offset < 0.0) offset = 0.0;
if (offset > 1.0) offset = 1.0;
grd.addColorStop(offset, color);
}
}
Fayde.CoreLibrary.add(GradientBrush);
Markup.Content(GradientBrush, GradientBrush.GradientStopsProperty);
}
}
6 changes: 3 additions & 3 deletions src/Media/LinearGradientBrush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Fayde.Media {
var grd = ctx.createLinearGradient(data.start.x, data.start.y, data.end.x, data.end.y);
for (var en = this.GradientStops.getEnumerator(); en.moveNext();) {
var stop: GradientStop = en.current;
grd.addColorStop(stop.Offset, stop.Color.toString());
this.AddColorStop(grd, stop.Offset, stop.Color.toString());
}
return grd;
}
Expand All @@ -35,7 +35,7 @@ module Fayde.Media {
var stop = en.current;
var offset = interpolator.interpolate(stop.Offset);
if (offset >= 0 && offset <= 1)
grd.addColorStop(offset, stop.Color.toString());
this.AddColorStop(grd, offset, stop.Color.toString());
}
}
return grd;
Expand Down Expand Up @@ -72,4 +72,4 @@ module Fayde.Media {
}
}
Fayde.CoreLibrary.add(LinearGradientBrush);
}
}
6 changes: 3 additions & 3 deletions src/Media/RadialGradientBrush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Fayde.Media {
var grd = (!data.balanced ? tmpCtx : ctx).createRadialGradient(data.x0, data.y0, 0, data.x1, data.y1, data.r1);
for (var en = this.GradientStops.getEnumerator(); en.moveNext();) {
var stop: GradientStop = en.current;
grd.addColorStop(stop.Offset, stop.Color.toString());
this.AddColorStop(grd, stop.Offset, stop.Color.toString());
}
return this.FitPattern(ctx, grd, data, bounds);
}
Expand Down Expand Up @@ -51,7 +51,7 @@ module Fayde.Media {
var offset = en.current.Offset;
if (reflect && inverted)
offset = 1 - offset;
grd.addColorStop(offset, en.current.Color.toString());
this.AddColorStop(grd, offset, en.current.Color.toString());
}
tmpCtx.fillStyle = grd;
tmpCtx.beginPath();
Expand Down Expand Up @@ -131,4 +131,4 @@ module Fayde.Media {
}
}
Fayde.CoreLibrary.add(RadialGradientBrush);
}
}
4 changes: 3 additions & 1 deletion src/Primitives/Color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ Fayde.CoreLibrary.addPrimitive(Color);
nullstone.registerTypeConverter(Color, (val: any): Color => {
if (!val || val instanceof Color)
return <Color>val;
if (val instanceof (<any>Fayde).Media.SolidColorBrush)
return (<any>val).Color;
val = val.toString();
if (val[0] !== "#") {
var color = Color.KnownColors[val];
Expand All @@ -242,4 +244,4 @@ nullstone.registerTypeConverter(Color, (val: any): Color => {
return color;
}
return Color.FromHex(val);
});
});

0 comments on commit 4ac5205

Please sign in to comment.