summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8f95e11)
raw | patch | inline | side by side (parent: 8f95e11)
author | Stas'M <x86corez@gmail.com> | |
Sat, 6 Oct 2018 15:34:47 +0000 (18:34 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sat, 6 Oct 2018 15:34:47 +0000 (18:34 +0300) |
src/editor/f_main.pas | patch | blob | history | |
src/editor/g_map.pas | patch | blob | history |
diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index ea7b4a9f7ed7e9e06909419ab9de7680ff8e377d..339fbcf095c2bde9e415b606f646037c78786c43 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
MouseRDown: Boolean;
MouseLDownPos: Types.TPoint;
MouseRDownPos: Types.TPoint;
- WASDOffset: TPoint;
SelectFlag: Byte = SELECTFLAG_NONE;
MouseAction: Byte = MOUSEACTION_NONE;
if MouseAction = MOUSEACTION_MOVEOBJ then
begin
MoveSelectedObjects(ssShift in Shift, ssCtrl in Shift,
- MousePos.X-LastMovePoint.X+WASDOffset.X,
- MousePos.Y-LastMovePoint.Y+WASDOffset.Y);
- WASDOffset.X := 0;
- WASDOffset.Y := 0;
+ MousePos.X-LastMovePoint.X,
+ MousePos.Y-LastMovePoint.Y);
end
else
// Меняем размер выделенного объекта:
if (SelectedObjectCount = 1) and
(SelectedObjects[GetFirstSelected].Live) then
begin
- dWidth := MousePos.X-LastMovePoint.X+WASDOffset.X;
- dHeight := MousePos.Y-LastMovePoint.Y+WASDOffset.Y;
- WASDOffset.X := 0;
- WASDOffset.Y := 0;
+ dWidth := MousePos.X-LastMovePoint.X;
+ dHeight := MousePos.Y-LastMovePoint.Y;
case ResizeType of
RESIZETYPE_VERTICAL: dWidth := 0;
RESIZEDIR_LEFT: dWidth := -dWidth;
end;
- ResizeObject(SelectedObjects[GetFirstSelected].ObjectType,
- SelectedObjects[GetFirstSelected].ID,
- dWidth, dHeight, ResizeDirection);
-
- LastMovePoint := MousePos;
+ if ResizeObject(SelectedObjects[GetFirstSelected].ObjectType,
+ SelectedObjects[GetFirstSelected].ID,
+ dWidth, dHeight, ResizeDirection) then
+ LastMovePoint := MousePos;
end;
end;
end;
Inc(MouseLDownPos.y, DotStep);
Inc(MouseRDownPos.y, DotStep);
end;
- Dec(WASDOffset.Y, DotStep);
+ Inc(LastMovePoint.Y, DotStep);
RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
Position := IfThen(Position > DotStep, Position-DotStep, 0);
Dec(MouseLDownPos.y, DotStep);
Dec(MouseRDownPos.y, DotStep);
end;
- Inc(WASDOffset.Y, DotStep);
+ Dec(LastMovePoint.Y, DotStep);
RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
Position := IfThen(Position+DotStep < Max, Position+DotStep, Max);
Inc(MouseLDownPos.x, DotStep);
Inc(MouseRDownPos.x, DotStep);
end;
- Dec(WASDOffset.X, DotStep);
+ Inc(LastMovePoint.X, DotStep);
RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
Position := IfThen(Position > DotStep, Position-DotStep, 0);
Dec(MouseLDownPos.x, DotStep);
Dec(MouseRDownPos.x, DotStep);
end;
- Inc(WASDOffset.X, DotStep);
+ Dec(LastMovePoint.X, DotStep);
RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
Position := IfThen(Position+DotStep < Max, Position+DotStep, Max);
diff --git a/src/editor/g_map.pas b/src/editor/g_map.pas
index 008c1a49ae09f0740e6c03f38beed5fbcbbe2f79..4c94a1938a170069bfe2d38815bf10d5de605380 100644 (file)
--- a/src/editor/g_map.pas
+++ b/src/editor/g_map.pas
function ObjectCollide(ObjectType: Byte; ID: DWORD; fX, fY: Integer; fWidth, fHeight: Word): Boolean;
function ObjectGetRect(ObjectType: Byte; ID: DWORD): TRectWH;
procedure MoveObject(ObjectType: Byte; ID: DWORD; dX, dY: Integer);
-procedure ResizeObject(ObjectType: Byte; ID: DWORD; dWidth, dHeight: Integer; ResizeDir: Byte);
+function ResizeObject(ObjectType: Byte; ID: DWORD; dWidth, dHeight: Integer; ResizeDir: Byte): Boolean;
function ObjectSelected(ObjectType: Byte; ID: DWORD): Boolean;
function GetPanelName(PanelType: Word): String;
end;
end;
-procedure ResizeObject(ObjectType: Byte; ID: DWORD; dWidth, dHeight: Integer; ResizeDir: Byte);
+function ResizeObject(ObjectType: Byte; ID: DWORD; dWidth, dHeight: Integer; ResizeDir: Byte): Boolean;
begin
+ Result := True;
case ObjectType of
OBJECT_PANEL:
with gPanels[ID] do
else
begin
Width := 0;
+ Result := False;
Exit;
end;
else
begin
Height := 0;
+ Result := False;
Exit;
end;
else
begin
Width := 0;
+ Result := False;
Exit;
end;
else
begin
Height := 0;
+ Result := False;
Exit;
end;