Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd.js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
regiostart
psd.js
Commits
6a23a9a7
Commit
6a23a9a7
authored
May 04, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow setting coords through setter
parent
8109e146
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
node.coffee
lib/psd/node.coffee
+22
-10
No files found.
lib/psd/node.coffee
View file @
6a23a9a7
...
...
@@ -28,12 +28,24 @@ module.exports = class Node extends Module
@
createProperties
()
createProperties
:
->
Object
.
defineProperty
@
,
'top'
,
get
:
->
@
coords
.
top
+
@
topOffset
Object
.
defineProperty
@
,
'right'
,
get
:
->
@
coords
.
right
+
@
leftOffset
Object
.
defineProperty
@
,
'bottom'
,
get
:
->
@
coords
.
bottom
+
@
topOffset
Object
.
defineProperty
@
,
'left'
,
get
:
->
@
coords
.
left
+
@
leftOffset
Object
.
defineProperty
@
,
'width'
,
get
:
->
@
right
-
@
left
Object
.
defineProperty
@
,
'height'
,
get
:
->
@
bottom
-
@
top
Object
.
defineProperty
@
,
'top'
,
get
:
->
@
coords
.
top
+
@
topOffset
set
:
(
val
)
->
@
coords
.
top
=
val
Object
.
defineProperty
@
,
'right'
,
get
:
->
@
coords
.
right
+
@
leftOffset
set
:
(
val
)
->
@
coords
.
right
=
val
Object
.
defineProperty
@
,
'bottom'
,
get
:
->
@
coords
.
bottom
+
@
topOffset
set
:
(
val
)
->
@
coords
.
bottom
=
val
Object
.
defineProperty
@
,
'left'
,
get
:
->
@
coords
.
left
+
@
leftOffset
set
:
(
val
)
->
@
coords
.
left
=
val
Object
.
defineProperty
@
,
'width'
,
get
:
->
@
right
-
@
left
Object
.
defineProperty
@
,
'height'
,
get
:
->
@
bottom
-
@
top
get
:
(
prop
)
->
if
@
[
prop
]
?
then
@
[
prop
]
else
@
layer
[
prop
]
...
...
@@ -75,7 +87,7 @@ module.exports = class Node extends Module
return
if
@
isRoot
()
nonEmptyChildren
=
@
children
.
filter
((
c
)
->
not
c
.
isEmpty
())
@
coords
.
left
=
_
.
min
(
nonEmptyChildren
.
map
((
c
)
->
c
.
left
))
or
0
@
coords
.
top
=
_
.
min
(
nonEmptyChildren
.
map
((
c
)
->
c
.
top
))
or
0
@
coords
.
bottom
=
_
.
max
(
nonEmptyChildren
.
map
((
c
)
->
c
.
bottom
))
or
0
@
coords
.
right
=
_
.
max
(
nonEmptyChildren
.
map
((
c
)
->
c
.
right
))
or
0
\ No newline at end of file
@
left
=
_
.
min
(
nonEmptyChildren
.
map
((
c
)
->
c
.
left
))
or
0
@
top
=
_
.
min
(
nonEmptyChildren
.
map
((
c
)
->
c
.
top
))
or
0
@
bottom
=
_
.
max
(
nonEmptyChildren
.
map
((
c
)
->
c
.
bottom
))
or
0
@
right
=
_
.
max
(
nonEmptyChildren
.
map
((
c
)
->
c
.
right
))
or
0
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment