kopia lustrzana https://github.com/backface/turtlestitch
Update MIGRATING.md
rodzic
e256a09cf1
commit
306fdb5f8c
62
MIGRATING.md
62
MIGRATING.md
|
@ -10,15 +10,15 @@ The second section is a recipe how to actually migrate your code. It's a list of
|
||||||
|
|
||||||
## Morphic Changes
|
## Morphic Changes
|
||||||
|
|
||||||
* `noticesTransparentClick` => `!isFreeForm` (reversed default)
|
* `noticesTransparentClick` => `!isFreeForm` (reversed default)
|
||||||
* `drawOn()` / `fullDrawOn()` takes context instead of Canvas as first arg
|
* `drawOn()` / `fullDrawOn()` takes context instead of Canvas as first arg
|
||||||
* `drawNew()` is deprecated => `render()`, also takes context as arg
|
* `drawNew()` is deprecated => `render()`, also takes context as arg
|
||||||
* new`rerender()` to earmark for rerendering
|
* new`rerender()` to earmark for rerendering
|
||||||
* `.image`accessing has been turned intoa getter method: `getImage()`
|
* `.image`accessing has been turned intoa getter method: `getImage()`
|
||||||
* `.image`property has been deprecated, renamed to `cachedImage`for Morphs that need to check for pixel-wise collision frequently
|
* `.image`property has been deprecated, renamed to `cachedImage`for Morphs that need to check for pixel-wise collision frequently
|
||||||
* new `isCachingImage` flag (default: false)
|
* new `isCachingImage` flag (default: false)
|
||||||
* new `shouldRerender` flag (default: false)
|
* new `shouldRerender` flag (default: false)
|
||||||
* `fixLayout()`is now available for all Morphs, determines extent and arranges submorphs, if any, gets called from `setExtent()`
|
* `fixLayout()`is now available for all Morphs, determines extent and arranges submorphs, if any, gets called from `setExtent()`
|
||||||
* new `fixHolesLayout()` method in case your Morphs have untouchable areas ("holes")
|
* new `fixHolesLayout()` method in case your Morphs have untouchable areas ("holes")
|
||||||
* "silent" - functions are no longer needed, e.g. `silentSetExtent()`, `silentMoveBy()`
|
* "silent" - functions are no longer needed, e.g. `silentSetExtent()`, `silentMoveBy()`
|
||||||
- `silentSetExtent` => use `bounds.setExtent()` to avoid infinite recursion
|
- `silentSetExtent` => use `bounds.setExtent()` to avoid infinite recursion
|
||||||
|
@ -37,7 +37,7 @@ The second section is a recipe how to actually migrate your code. It's a list of
|
||||||
- `new Color()`, `new Color(0, 0, 0)` => `BLACK`
|
- `new Color()`, `new Color(0, 0, 0)` => `BLACK`
|
||||||
- `new Color(255, 255, 255)` => `WHITE`
|
- `new Color(255, 255, 255)` => `WHITE`
|
||||||
* `virtualKeyboard` property in Morphic preference has been deprecated
|
* `virtualKeyboard` property in Morphic preference has been deprecated
|
||||||
* `fullImageClassic()` => is now always just `fullImage()`
|
* `fullImageClassic()` => is now always just `fullImage()`
|
||||||
* `keyboardReceiver` => `keyboardFocus`
|
* `keyboardReceiver` => `keyboardFocus`
|
||||||
* keyboard navigation can be activated for any visible menu by pressing an arbitrary key
|
* keyboard navigation can be activated for any visible menu by pressing an arbitrary key
|
||||||
* new `noDropShadow` property for Morphs that already have built-in shadows (Menus, SpeechBubbles)
|
* new `noDropShadow` property for Morphs that already have built-in shadows (Menus, SpeechBubbles)
|
||||||
|
@ -47,33 +47,33 @@ The second section is a recipe how to actually migrate your code. It's a list of
|
||||||
|
|
||||||
Search your code for these words and replace them according to the instructions. It's best to follow the order given here. The last 3 replacements with constants are optional optimizations and can be left out.
|
Search your code for these words and replace them according to the instructions. It's best to follow the order given here. The last 3 replacements with constants are optional optimizations and can be left out.
|
||||||
|
|
||||||
**Words to search your code for**
|
**Words to search your code for:**
|
||||||
|
|
||||||
* **drawNew**
|
* **drawNew**
|
||||||
- rename method definitions to "render", notice that the first argument needs to be the 2D context, therefore remove the part in the code that makes a new canvas and queries its context.
|
- rename method definitions to `render`, notice that the first argument needs to be the 2D context, therefore remove the part in the code that makes a new canvas and queries its context.
|
||||||
- factor out the parts of the code that determine and set the extent and move them into a - possibly new - method named fixLayout()
|
- factor out the parts of the code that determine and set the extent and move them into a - possibly new - method named `fixLayout()`
|
||||||
- rename function calls to drawNew() to fixLayout() and/or rerender(), check whether the call is at all needed as it might be redundant in the new system
|
- rename function calls to `drawNew()` to `fixLayout()` and/or `rerender()`, check whether the call is at all needed as it might be redundant in the new system
|
||||||
* **wantsRedraw** => replace with rerender()
|
* **wantsRedraw** => replace with `rerender()`
|
||||||
* **noticesTransparentClick** => replace with => !isFreeForm, use with caution, as free forms should also cache their image for performance reason, which in turn strains memory usage
|
* **noticesTransparentClick** => replace with `!isFreeForm`, use with caution, as free forms should also cache their image for performance reason, which in turn strains memory usage
|
||||||
* **.image** => remove getters to getImage(), use with caution because of performance bottlenecks
|
* **.image** => rename getters to `getImage()`, use with caution because of performance bottlenecks
|
||||||
* **cachedFullImage** => no longer supported, remove all references
|
* **cachedFullImage** => no longer supported, remove all references
|
||||||
* **fullImageClassic** => rename method calls to just fullImage()
|
* **fullImageClassic** => rename method calls to just `fullImage()`
|
||||||
* **silentSet**
|
* **silentSet**
|
||||||
- remove method definitions
|
- remove method definitions
|
||||||
- rename method calls:
|
- rename method calls:
|
||||||
- silentSetExtent => use bounds.setExtent() to avoid infinite recursion
|
- *silentSetExtent* => use `bounds.setExtent()` to avoid infinite recursion
|
||||||
- silentMoveBy => use moveBy()
|
- *silentMoveBy* => use `moveBy()`
|
||||||
- silentSetPosition => use setPosition()
|
- *silentSetPosition* => use `setPosition()`
|
||||||
- silentSetWidth => use bounds.setWidth() to avoid infinite recursion
|
- *silentSetWidth* => use `bounds.setWidth()` to avoid infinite recursion
|
||||||
- silentSetHeight = use bounds.setHeight() to avoid infinite recursion
|
- *silentSetHeight* = use `bounds.setHeight()` to avoid infinite recursion
|
||||||
* **silentMove** => replace silentMoveBy() with moveBy()
|
* **silentMove** => replace `silentMoveBy()` with `moveBy()`
|
||||||
* **silentReplace** => (Snap! only) use replace instead
|
* **silentReplace** => (Snap! only) use replace instead
|
||||||
* **silent** => remove parameters named "silent" from function definitions and calls
|
* **silent** => remove parameters named "silent" from function definitions and calls
|
||||||
* **cachedFullBounds** => no longer supported, remove all references
|
* **cachedFullBounds** => no longer supported, remove all references
|
||||||
* **trackChanges** => no longer supported, remove all references
|
* **trackChanges** => no longer supported, remove all references
|
||||||
* **keyboardReceiver** => rename to keyboardFocus
|
* **keyboardReceiver** => rename to `keyboardFocus`
|
||||||
* **startLayout** => no longer supported, remove all calls
|
* **startLayout** => no longer supported, remove all calls
|
||||||
* **endLayout** => no longer supported, remove all calls
|
* **endLayout** => no longer supported, remove all calls
|
||||||
* **new Point(0, 0)** => ZERO, but only if the point is not to be mutated
|
* **new Point(0, 0)** => `ZERO`, but only if the point is not to be mutated
|
||||||
* **new Color() / new Color(0, 0, 0)** => BLACK, again, only if the color is not to be mutated
|
* **new Color() / new Color(0, 0, 0)** => `BLACK`, again, only if the color is not to be mutated
|
||||||
* **new Color(255, 255, 255)** => WHITE
|
* **new Color(255, 255, 255)** => `WHITE`
|
||||||
|
|
Ładowanie…
Reference in New Issue