Skip to content

Commit

Permalink
instantiate
Browse files Browse the repository at this point in the history
  • Loading branch information
monsterkodi committed Jul 6, 2018
1 parent 485ac2d commit 0e4aab6
Show file tree
Hide file tree
Showing 9 changed files with 448 additions and 13 deletions.
2 changes: 1 addition & 1 deletion coffee/edit/points.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class Points extends Convert
# 000 000 000 000 000 0000 000 000
# 000 0000000 000 000 000 000 0000000

@isFakeItem: (item) -> item.type in ['circle', 'ellipse', 'rect', 'text', 'image']
@isFakeItem: (item) -> item.type in ['circle', 'ellipse', 'rect', 'text', 'image', 'use']
isFake: -> Points.isFakeItem @item
isPoly: -> @item.type in ['polygon', 'polyline', 'line', 'circle', 'ellipse', 'rect', 'text', 'image']
isPath: -> @item.type == 'path'
Expand Down
1 change: 1 addition & 0 deletions coffee/kali.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class Kali
when 'Lock' then return post.emit 'tool', 'button', 'lock', 'lock'
when 'Unlock' then return post.emit 'tool', 'button', 'lock', 'unlock'

when 'Instantiate' then return @stage.instantiate()
when 'Group' then return post.emit 'tool', 'group'
when 'Ungroup' then return post.emit 'tool', 'ungroup'

Expand Down
3 changes: 2 additions & 1 deletion coffee/menu.noon
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Edit
Back alt+ctrl+down
Select
All ctrl+a a
None ctrl+d d
None ctrl+shift+a ctrl+d d
Invert ctrl+i i
-
Select Groups alt+g
Expand All @@ -90,6 +90,7 @@ Edit
--
Group ctrl+g g
Ungroup ctrl+u u
Instantiate alt+i
---
Cut ctrl+x x
Copy ctrl+c c
Expand Down
21 changes: 21 additions & 0 deletions coffee/stage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,28 @@ class Stage
else
log 'dafuk? empty?', svg?

# 000 000 000 0000000 000000000 0000000 000 000 000000000 000 0000000 000000000 00000000
# 000 0000 000 000 000 000 000 0000 000 000 000 000 000 000 000
# 000 000 0 000 0000000 000 000000000 000 0 000 000 000 000000000 000 0000000
# 000 000 0000 000 000 000 000 000 0000 000 000 000 000 000 000
# 000 000 000 0000000 000 000 000 000 000 000 000 000 000 000 00000000

instantiate: ->

sortedItems = @sortedSelectedItems()

if sortedItems.length > 1
@group()
@defs()
return

item = first sortedItems

@do()
instance = @activeLayer().use(item)
@selection.setItems [instance]
@done()

# 000 0000000 0000000 0000000
# 000 000 000 000 000 000 000
# 000 000 000 000000000 000 000
Expand Down
2 changes: 1 addition & 1 deletion coffee/tool/group.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Group extends Tool
# 0000000 000 000000000 000 0000 0000000
# 000 000 000 000 000 000 000
# 0000000 000 000 000 0000000 00000000

# 0000000 00000000 0000000 000 000 00000000
# 000 000 000 000 000 000 000 000 000
# 000 0000 0000000 000 000 000 000 00000000
Expand Down
2 changes: 1 addition & 1 deletion coffee/tool/select.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Select extends Tool
action: => @setShapeText 'shape-text'
,
name: 'text'
tiny: 'select-text'
tiny: 'text'
choice: @shapeText
action: => @setShapeText 'text'
]
Expand Down
2 changes: 1 addition & 1 deletion package.noon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name kaligraf
productName kaligraf
version 0.42.0
version 0.43.0
description svg editor
main js/app.js
author monsterkodi
Expand Down
21 changes: 13 additions & 8 deletions svg/test/test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0e4aab6

Please sign in to comment.