Skip to content

Commit

Permalink
Remove jQuery, switch dependency to Cornerstone 2.0.0, bump to versio…
Browse files Browse the repository at this point in the history
  • Loading branch information
swederik authored Dec 13, 2017
1 parent 1706361 commit 2918218
Show file tree
Hide file tree
Showing 125 changed files with 5,489 additions and 5,345 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ module.exports = {
'brace-style': 'warn',
'callback-return': 'warn',
'camelcase': 'warn',
'capitalized-comments': 'warn',
'capitalized-comments': [
"warn",
"always",
{
"ignorePattern": "pragma|ignored",
"ignoreInlineComments": true
}
],
'class-methods-use-this': 'warn',
'comma-dangle': 'warn',
'comma-spacing': [
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,12 @@ See the [live examples](https://rawgithub.com/cornerstonejs/cornerstoneTools/mas

````javascript
// Load NPM packages
import $ from 'jquery'; // npm install --save jquery
import Hammer from 'hammerjs'; // npm install --save hammerjs
import * as cornerstone from 'cornerstone-core'; // npm install --save cornerstone-core
import * as cornerstoneTools from 'cornerstone-tools';

// Specify external dependencies
cornerstone.external.$ = $;
cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.$ = $;
cornerstoneTools.external.Hammer = Hammer;
````

Expand All @@ -213,14 +210,12 @@ cornerstoneTools.external.Hammer = Hammer;

````javascript
// Load Packaged Sources
<script src="https://unpkg.com/[email protected]/dist/jquery.js"></script>
<script src="https://unpkg.com/[email protected]/hammer.js"></script>
<script src="https://unpkg.com/cornerstone-core@1.1.0/dist/cornerstone.min.js"></script>
<script src="https://unpkg.com/cornerstone-tools@1.0.2/dist/cornerstoneTools.min.js"></script>
<script src="https://unpkg.com/cornerstone-core@2.0.0/dist/cornerstone.min.js"></script>
<script src="https://unpkg.com/cornerstone-tools@2.0.0/dist/cornerstoneTools.min.js"></script>

// Specify external dependencies
cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.$ = $;
cornerstoneTools.external.Hammer = Hammer;
````

Expand Down
46 changes: 42 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2017-12-13
### Added
- Began the [Getting Started guide](https://tools.cornerstonejs.org/essentials/getting-started.html) (thanks @dannyrb)
- Since we are now using addEventListener/removeEventListener instead of jQuery's on/off, we had to create a separate cache for event data for each element / tool type combination since it cannot be passed to the handler when creating the listener.

This is present in toolOptions.js and available as ````setToolOptions(toolType, element, options)```` and ````getToolOptions(toolType, element)````. These are now used to keep track of which mouse button is enabled for which tool and element.

### Changed
- *Breaking Change!!!* Removed all dependence on jQuery. This was a long process and we'd like to thank all the contributors that have come forward from the community to help.

If you are listening to any Cornerstone Tools event, and your event handler has the signature

````javascript
function(event, eventData) {
// do stuff
}````

You need to switch it to:

````javascript
function(event) {
const eventData = event.detail;
// do stuff
}
````

since this is how it is now being fired using native CustomEvents.

- *Breaking Change!!!* Lower-cased all event names. This was done because we had two parallel sets of events (jQuery events and native Custom Events) in the previous major version. The jQuery events have now been removed. Check events.js for the list of event names. e.g. CornerstoneToolsMouseDrag -> cornerstonetoolsmousedrag

- *Breaking Change!!!* jQuery Events are no longer being dispatched by triggerEvent.js

- *Breaking Change!!!* Cornerstone Tools now depends on Cornerstone Core >= 2.0.0.

- Removed jQuery from nearly all of the examples and replaced with native APIs. It is still being used in the All Image Tools example, solely for the Bootstrap dropdown.
- Centralized all of the event names in events.js
- Switched ESLint's capitalized-comments warning to ignore inline comments

## [1.1.3] - 2017-12-13
### Added
- Gitbook integration for improving our documentation. View it live at https://tools.cornerstonejs.org (thanks @dannyrb)
Expand Down Expand Up @@ -35,7 +73,7 @@ to do so. This is not required for normal use, as window.cornerstoneMath is the
## [1.1.0] - 2017-11-17
### Added
- Internal triggerEvent function which triggers jQuery and CustomEvents side-by-side. These events are the same as the current
event names, but with all lower case letters. E.g. CornerstoneToolsMouseMove => cornerstonetoolsmousemove
event names, but with all lower case letters. E.g. CornerstoneToolsMouseMove => cornerstonetoolsmousemove

This will be the prevailing format moving forward, but you aren't forced to migrate until 2.0.0 when we plan to drop the jQuery events.

Expand All @@ -47,11 +85,11 @@ from Cornerstone Core. We can now remove jQuery events from Core without breakin

## Version 1.0.3

- Biggest change: Tools that required 'imagePlane' metadata, now require 'imagePlaneModule':
- Biggest change: Tools that required 'imagePlane' metadata, now require 'imagePlaneModule':

This is partly a breaking change but in reality will help most users, since CornerstoneWADOImageLoader is populating 'imagePlaneModule', not 'imagePlane'. Thanks to @dannyrb for this fix.

*Note*: If you have written your own metadata provider, you should now use 'imagePlaneModule' instead of 'imagePlane'.
*Note*: If you have written your own metadata provider, you should now use 'imagePlaneModule' instead of 'imagePlane'.

- Refactored the Brush tool into brush.js and brushTool.js. This works similarly to mouseButtonTool.
- Brush tool now draws / erases on a label map, which is rendered by Cornerstone with a color lookup table.
Expand Down Expand Up @@ -130,4 +168,4 @@ We apologize for any headaches that the breaking change 0.10.0 may have caused f
- If initialData.distances[sourceImageId] is undefined in Synchroziner.js, keep positionDifference undefined instead of crashing
- Resolve the error "Error during loading "karma-phantomjs-launcher" plugin: Path must be a string. Received null", throwed when submiting the PR.
- Remove the useless variable 'viewport' in playClip.js and scrollToIndex.js
- LengthTool now uses PixelSpacing provided by MetaDataProvider
- LengthTool now uses PixelSpacing provided by MetaDataProvider
1 change: 0 additions & 1 deletion config/karma/karma-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = {
frameworks: ['mocha'],
reporters: ['progress', 'coverage'],
files: [
'node_modules/jquery/dist/jquery.js',
'node_modules/cornerstone-core/dist/cornerstone.js',
'node_modules/cornerstone-math/dist/cornerstoneMath.js',
'node_modules/hammerjs/hammer.js',
Expand Down
Loading

0 comments on commit 2918218

Please sign in to comment.