From f24ed33faaa8d7db6822a9ff4c1eff57617caf83 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Wed, 14 Mar 2018 12:33:40 +0100 Subject: dragndrop of GObjs --- CrowIDE/src/GraphicObjectDesignContainer.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'CrowIDE/src/GraphicObjectDesignContainer.cs') diff --git a/CrowIDE/src/GraphicObjectDesignContainer.cs b/CrowIDE/src/GraphicObjectDesignContainer.cs index e7776d26..4540898b 100644 --- a/CrowIDE/src/GraphicObjectDesignContainer.cs +++ b/CrowIDE/src/GraphicObjectDesignContainer.cs @@ -30,6 +30,14 @@ namespace Crow.Coding { public class GraphicObjectDesignContainer { + #region CTOR + public GraphicObjectDesignContainer (Type crowType) + { + CrowType = crowType; + } + #endregion + + int dragIconSize = 32; public Type CrowType; public string IconPath { @@ -38,24 +46,18 @@ namespace Crow.Coding public string DisplayName { get { return CrowType.Name; } } - - public GraphicObjectDesignContainer (Type crowType) - { - CrowType = crowType; - } - int dis = 32; void onStartDrag (object sender, EventArgs e) { GraphicObject go = sender as GraphicObject; lock (go.IFace.UpdateMutex) { - go.IFace.DragImageHeight = dis; - go.IFace.DragImageWidth = dis; + go.IFace.DragImageHeight = dragIconSize; + go.IFace.DragImageWidth = dragIconSize; SvgPicture pic = new SvgPicture (); pic.Load (go.IFace, IconPath); - ImageSurface img = new ImageSurface (Format.Argb32, dis, dis); + ImageSurface img = new ImageSurface (Format.Argb32, dragIconSize, dragIconSize); using (Context ctx = new Context (img)) { - Rectangle r = new Rectangle (0, 0, dis, dis); + Rectangle r = new Rectangle (0, 0, dragIconSize, dragIconSize); pic.Paint (ctx, r); ctx.Operator = Operator.In; ctx.SetSourceRGBA (1.0, 1.0, 1.0, 1.0); -- cgit v1.3.1-4-g156e