-
Notifications
You must be signed in to change notification settings - Fork 342
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
Remove setRotationCenter API #581
Merged
adroitwhiz
merged 1 commit into
scratchfoundation:develop
from
adroitwhiz:remove-set-rotation-center
Jul 9, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,6 @@ const twgl = require('twgl.js'); | |
const RenderConstants = require('./RenderConstants'); | ||
const Silhouette = require('./Silhouette'); | ||
|
||
/** | ||
* Truncate a number into what could be stored in a 32 bit floating point value. | ||
* @param {number} num Number to truncate. | ||
* @return {number} Truncated value. | ||
*/ | ||
const toFloat32 = (function () { | ||
const memory = new Float32Array(1); | ||
return function (num) { | ||
memory[0] = num; | ||
return memory[0]; | ||
}; | ||
}()); | ||
|
||
class Skin extends EventEmitter { | ||
/** | ||
* Create a Skin, which stores and/or generates textures for use in rendering. | ||
|
@@ -101,26 +88,6 @@ class Skin extends EventEmitter { | |
return [0, 0]; | ||
} | ||
|
||
/** | ||
* Set the origin, in object space, about which this Skin should rotate. | ||
* @param {number} x - The x coordinate of the new rotation center. | ||
* @param {number} y - The y coordinate of the new rotation center. | ||
* @fires Skin.event:WasAltered | ||
*/ | ||
setRotationCenter (x, y) { | ||
const emptySkin = this.size[0] === 0 && this.size[1] === 0; | ||
// Compare a 32 bit x and y value against the stored 32 bit center | ||
// values. | ||
const changed = ( | ||
toFloat32(x) !== this._rotationCenter[0] || | ||
toFloat32(y) !== this._rotationCenter[1]); | ||
if (!emptySkin && changed) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this is replaced by https://github.com/LLK/scratch-render/pull/561/files |
||
this._rotationCenter[0] = x; | ||
this._rotationCenter[1] = y; | ||
this.emit(Skin.Events.WasAltered); | ||
} | ||
} | ||
|
||
/** | ||
* Get the center of the current bounding box | ||
* @return {Array<number>} the center of the current bounding box | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to document the properties, but not necessarily in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if this function is going away it doesn't matter