Skip to content

Commit 62bed8a

Browse files
committed
update README
1 parent 4e54313 commit 62bed8a

File tree

1 file changed

+33
-38
lines changed

1 file changed

+33
-38
lines changed

README.md

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,69 @@ A simple bounding box widget empowering users with the ability to move, rotate o
55

66
## Usage
77

8-
```
98
# create a new ldr instance.
109
ldr = new ldResize ...
1110

1211
# attach to certain node.
1312
ldr.attach node
1413

1514
ldr.on \resize, -> ...
16-
satate = ldr.get!
15+
state = ldr.get!
1716

1817
ldr.detach!
19-
```
2018

2119

2220
## Configuration
2321

2422
configs are set in a object which is passed into the ldResize constructor. For example:
2523

26-
```
2724
new ldResize({root: ".root"});
28-
```
2925

3026

3127
## Configuration
3228

33-
* host - CSS selector or element where to put resize widget elements. will use `root` if `host` is omitted.
34-
* root - CSS selector or element for the container of the elements to be resized.
29+
* `host` - CSS selector or element where to put resize widget elements. will use `root` if `host` is omitted.
30+
* `root` - CSS selector or element for the container of the elements to be resized.
3531
ldResize automatically intercept mouse events for elements in `root` and handle the interactions.
36-
* filter(n) - callback function to determine if an element `n` should be resized.
32+
* `filter(n)` - callback function to determine if an element `n` should be resized.
3733
ldResize by default resizes all elements if filter is omitted.
3834
called on mousedown on root element.
39-
* mousedown - TBD
40-
* visible-ctrl-r - default false. show all rotating ctrl node if true.
35+
* `mousedown` - TBD
36+
* `visible-ctrl-r` - default false. show all rotating ctrl node if true.
4137

4238

4339
## API
4440

45-
46-
* attach(n,append): attach resizer to certain node(s) and show resize widget.
47-
- n: node(s) to be attached. can be a list or a single node. equivalent to detech if n = null.
48-
- append: default false. append n to current attached list if true.
49-
* detect(): clear attached list and hide resize widget.
50-
* render(): update transformation of resize widget and attached nodes.
51-
* pts: internal api ( TBD )
52-
* box-offset: internal api ( TBD )
53-
* get(): return an object representing transformation information as follow:
54-
- t: {x, y} - translate
55-
- s: {x, y} - scale
56-
- r - rotate
57-
- x, y, w, h - Bounding Rect. ( TBD? )
58-
- box - TBD
59-
* on(name, cb) - handle specific event `name` with function `cb`.
41+
* `attach(n,append)`: attach resizer to certain node(s) and show resize widget.
42+
- `n`: node(s) to be attached. can be a list or a single node. equivalent to detech if n = null.
43+
- `append`: default false. append n to current attached list if true.
44+
* `detect()`: clear attached list and hide resize widget.
45+
* `render()`: update transformation of resize widget and attached nodes.
46+
* `pts`: internal api ( TBD )
47+
* `box-offset`: internal api ( TBD )
48+
* `get()`: return an object representing transformation information as follow:
49+
- `t`: {x, y} - translate
50+
- `s`: {x, y} - scale
51+
- `r`: rotate
52+
- `x, y, w, h`: Bounding Rect. ( TBD? )
53+
- `box`: TBD
54+
* `on(name, cb)`: handle specific event `name` with function `cb`.
6055

6156
### API ( WIP )
62-
* set({t: {x, y}, s: {x, y}, r}, delta) - set affine transformation for attached node. ( No Yet Implemented )
57+
* `set({t`: {x, y}, s: {x, y}, r}, delta): set affine transformation for attached node. ( No Yet Implemented )
6358
if delta is true, all values in params are relative to current values.
6459

6560

6661
## Events
6762

68-
* `resize` - fire when resizing ( including translating, rotating and scaling ). arguments:
69-
- dim: transformation information. see `get` API for more information.
70-
- targets: list of affected nods
63+
* `resize`: fire when resizing ( including translating, rotating and scaling ). arguments:
64+
- `dim`: transformation information. see `get` API for more information.
65+
- `targets`: list of affected nods
7166

7267

7368
## Widget Hierarchy
7469

75-
ldResize will add a set of SVG elements for controlling the resize of any elements. this reizer widget is constructed as following hierarchy:
70+
ldResize will add a set of SVG elements for controlling the resize of any elements. This reizer widget is constructed with following structure:
7671

7772
* g
7873
- path.ldr-ctrl.bbox
@@ -82,21 +77,21 @@ ldResize will add a set of SVG elements for controlling the resize of any elemen
8277

8378
## CSS Classes Used
8479

85-
* ldr-host - host element
86-
- ldr-host-standalone - added on host element if root != host
87-
* ldr-ctrl - control points
88-
- r - ctrl points for rotating
89-
- s - ctrl points for resizing
90-
- bbox - wireframe of the resize rectangle
80+
* `ldr-host` - host element
81+
- `ldr-host-standalone` - added on host element if root != host
82+
* `ldr-ctrl` - control points
83+
- `r` - ctrl points for rotating
84+
- `s` - ctrl points for resizing
85+
- `bbox` - wireframe of the resize rectangle
9186

9287

9388
## Technical Note
9489

9590
* Additional interface:
96-
* ```node._lasttransform``` - old transform attribute will be stored in this attribute of specific node when ldResize is going to overwrite it.
91+
* `node._lasttransform` - old transform attribute will be stored in this attribute of specific node when ldResize is going to overwrite it.
9792
- currently, this is only done when _lasttransform is undefined.
9893
- TODO: add opt for customize attr name and store timing?
99-
* ldResize store transformation matrix for both parent and node in _mo and _mi member of an element. Also, old transform info is stored in _lasttransform. This is somewhat hacky, maybe we can find a better way to replace these in the future.
94+
* ldResize store transformation matrix for both parent and node in `_mo` and `_mi` member of an element. Also, old transform info is stored in `_lasttransform`. This is somewhat hacky, maybe we can find a better way to replace these in the future.
10095

10196

10297
## Todo

0 commit comments

Comments
 (0)