-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Daniel Worthington
authored
Oct 15, 2021
1 parent
53381c5
commit 34a3870
Showing
8 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
const Color = require('../Color'); | ||
const GraphicsContextSettings = require('../GraphicsContextSettings'); | ||
|
||
class InnerShadow { | ||
static get Model() { | ||
return { | ||
_class: 'innerShadow', | ||
isEnabled: true, | ||
blurRadius: 3, | ||
color: Color.Model, | ||
contextSettings: GraphicsContextSettings.Model, | ||
offsetX: 0, | ||
offsetY: 1, | ||
spread: 0, | ||
}; | ||
} | ||
|
||
constructor(args, json) { | ||
if (json) { | ||
Object.assign(this, json); | ||
} else { | ||
Object.assign(this, InnerShadow.Model, args, { | ||
color: new Color(args.color), | ||
}); | ||
} | ||
} | ||
} | ||
|
||
module.exports = InnerShadow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
const InnerShadow = require('./index'); | ||
|
||
const json = require('./__InnerShadow.json'); | ||
|
||
describe('InnerShadow', () => { | ||
it('should work from raw JSON', () => { | ||
const innerShadow = new InnerShadow(null, json); | ||
expect(JSON.stringify(json, null, 2)).toEqual(JSON.stringify(innerShadow, null, 2)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"_class": "innerShadow", | ||
"isEnabled": true, | ||
"blurRadius": 3, | ||
"offsetX": 0, | ||
"offsetY": 1, | ||
"spread": 0, | ||
"color": { | ||
"_class": "color", | ||
"alpha": 0.5, | ||
"blue": 0, | ||
"green": 0, | ||
"red": 0 | ||
}, | ||
"contextSettings": { | ||
"_class": "graphicsContextSettings", | ||
"blendMode": 0, | ||
"opacity": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Color from '../Color'; | ||
import GraphicsContextSettings from '../GraphicsContextSettings'; | ||
|
||
declare class InnerShadow { | ||
_class: 'innerShadow'; | ||
isEnabled: boolean; | ||
blurRadius: number; | ||
color: Color; | ||
contextSettings: GraphicsContextSettings; | ||
offsetX: number; | ||
offsetY: number; | ||
spread: number; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = InnerShadow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
module.exports = require('./InnerShadow'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters