projects
/
Misc
/
ipe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b58d153
)
now only paths that are visible are modified (one can still get the old behaviour...
author
Thomas Bläsius
<thomas.blaesius@kit.edu>
Wed, 11 Sep 2013 15:41:10 +0000
(17:41 +0200)
committer
Thomas Bläsius
<thomas.blaesius@kit.edu>
Wed, 11 Sep 2013 15:41:10 +0000
(17:41 +0200)
ipelets/graph/graph.lua
patch
|
blob
|
history
diff --git
a/ipelets/graph/graph.lua
b/ipelets/graph/graph.lua
index 52eb1880c761459c196e03ee405e863d179463c1..a61d7ef9a8223adcb6fafc5e3470848f969d50dc 100644
(file)
--- a/
ipelets/graph/graph.lua
+++ b/
ipelets/graph/graph.lua
@@
-6,6
+6,7
@@
label = "Graph"
about = [[ Some features making it easier to work with graphs. ]]
local deactivateGraphMode = false
about = [[ Some features making it easier to work with graphs. ]]
local deactivateGraphMode = false
+local moveInvisibleObjects = false
function toggleGraphMode ()
if deactivateGraphMode then
function toggleGraphMode ()
if deactivateGraphMode then
@@
-15,6
+16,14
@@
function toggleGraphMode ()
end
end
end
end
+function toggleMoveInvisible ()
+ if moveInvisibleObjects then
+ moveInvisibleObjects = false
+ else
+ moveInvisibleObjects = true
+ end
+end
+
local editing = false
local currMarkId = nil
local editing = false
local currMarkId = nil
@@
-111,7
+120,7
@@
function _G.EDITTOOL:key(code, modifiers, text)
undo = _G.revertOriginal,}
t.redo = function (t, doc)
p:transform(currMarkId, ipe.Translation(newPos-oldPos))
undo = _G.revertOriginal,}
t.redo = function (t, doc)
p:transform(currMarkId, ipe.Translation(newPos-oldPos))
- moveEndpoints(oldPos, newPos, p)
+ moveEndpoints(oldPos, newPos, p
, self.model
)
end
self.model:register(t)
end
end
self.model:register(t)
end
@@
-119,8
+128,13
@@
end
-- function moving all endpoints and intermediate points in polylines
-- to newPos, if the squared distance to oldPos is at most sqEps
local sqEps = 1
-- function moving all endpoints and intermediate points in polylines
-- to newPos, if the squared distance to oldPos is at most sqEps
local sqEps = 1
-function moveEndpoints(oldPos, newPos, p)
+function moveEndpoints(oldPos, newPos, p, model)
+ -- print(model.vno)
for i, obj, sel, layer in p:objects() do
for i, obj, sel, layer in p:objects() do
+ if not p:visible(model.vno, layer) and
+ not moveInvisibleObjects then
+ goto continue
+ end
if obj:type() == "path" then
local shape = obj:shape()
for _, subPath in ipairs(shape) do
if obj:type() == "path" then
local shape = obj:shape()
for _, subPath in ipairs(shape) do
@@
-147,6
+161,7
@@
function moveEndpoints(oldPos, newPos, p)
obj:setShape(shape)
end
end
obj:setShape(shape)
end
end
+ ::continue::
end
end
end
end
@@
-221,7
+236,7
@@
function getString(model, string)
end
function shorten(model, num)
end
function shorten(model, num)
- num = num -
1
+ num = num -
2
local lenTarget = 0
local lenSource = 0
-- local str = ipeui.getString(model.ui, "Enter length")
local lenTarget = 0
local lenSource = 0
-- local str = ipeui.getString(model.ui, "Enter length")
@@
-269,6
+284,7
@@
end
methods = {
{ label = "toggle graph mode", run=toggleGraphMode },
methods = {
{ label = "toggle graph mode", run=toggleGraphMode },
+ { label = "toggle move invisible", run=toggleMoveInvisible },
{ label = "shorten target", run=shorten },
{ label = "shorten source", run=shorten },
{ label = "shorten both", run=shorten },
{ label = "shorten target", run=shorten },
{ label = "shorten source", run=shorten },
{ label = "shorten both", run=shorten },