feat: marker har Til/Fra og er Fra som standard; Stop slår marken fra (1.62.200)
This commit is contained in:
@@ -142,11 +142,16 @@ function SmartPickupFrame:fillFieldRows(adEnv)
|
||||
local cells = self:addCellRow(self.fieldListPrefab, self:fieldCells(row))
|
||||
local fieldId = row.info.id
|
||||
if cells[1] ~= nil and cells[1].parent ~= nil then
|
||||
local actionCell = cells[7]
|
||||
local modeCell, statusCell, actionCell = cells[4], cells[5], cells[7]
|
||||
self:makeRowClickable(cells[1].parent, function(frame)
|
||||
-- klik på [Start]/[Stop]-feltet = handling (kun denne mark); ellers åbn redigeringsvinduet
|
||||
if frame.lastClickX ~= nil and actionCell ~= nil and actionCell.absPosition ~= nil and frame.lastClickX >= actionCell.absPosition[1] then
|
||||
-- klik på [Start]/[Stop]-feltet = handling (kun denne mark); [Til]/[Fra] = automatik;
|
||||
-- ellers åbn redigeringsvinduet
|
||||
local x = frame.lastClickX
|
||||
if x ~= nil and actionCell ~= nil and actionCell.absPosition ~= nil and x >= actionCell.absPosition[1] then
|
||||
frame:toggleField(fieldId)
|
||||
elseif x ~= nil and modeCell ~= nil and modeCell.absPosition ~= nil and statusCell ~= nil and statusCell.absPosition ~= nil
|
||||
and x >= modeCell.absPosition[1] and x < statusCell.absPosition[1] then
|
||||
frame:toggleFieldEnabled(fieldId)
|
||||
else
|
||||
frame.selectedFieldId = fieldId
|
||||
frame:openEditPanel("field", fieldId)
|
||||
@@ -376,6 +381,15 @@ function SmartPickupFrame:onClickFieldRow(state, data)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Til/Fra for én mark (rækkens [Til]/[Fra]-felt).
|
||||
function SmartPickupFrame:toggleFieldEnabled(id)
|
||||
self:safe(function(frame)
|
||||
if id == nil then return end
|
||||
ADFieldJobs.setFieldEnabled(id, not ADFieldModel.isEnabled(ADFieldJobs.getField(id)))
|
||||
frame:requestRebuild()
|
||||
end)
|
||||
end
|
||||
|
||||
-- Start nu: pleje hvis marken trænger (og vokser), ellers hele kæden (høst/slå, eller klargøring på bar mark).
|
||||
function SmartPickupFrame:onClickFieldStartStop()
|
||||
self:toggleField(self.selectedFieldId)
|
||||
|
||||
Reference in New Issue
Block a user