상속: Point
예제 #1
0
        public override bool OnClick(Pointer e)
        {
            if (!Visible) return false;
            if (Editor == null) return false;
            Clicking = true;
            ClickHandled = false;
            var scalex = Width / Editor.AssetFrame.Width;
            var scaley = Height / Editor.AssetFrame.Height;
            Editor.ShowHurtMap = ShowHurtMap;
            Editor.ShowCollideMap = ShowCollideMap;

            var pos = new Point(( e.X / scalex ), ( e.Y / scaley ));
            if (!Editable) {
                if (Click != null)
                    Click(pos);
            } else {
                LastPosition = pos;
                if (PaletteEditor != null)
                    Editor.CurrentColor = PaletteEditor.SelectedIndex;

                if (ShowHurtMap || ShowCollideMap)
                    Editor.CurrentColor = e.Right ? 0 : 1;

                Editor.DrawPixel(pos);
            }

            return base.OnClick(e);
        }
예제 #2
0
        public override bool OnMouseOver(Pointer e)
        {
            if (Editor == null) return false;

            var scalex = Width / Editor.AssetFrame.Width;
            var scaley = Height / Editor.AssetFrame.Height;

            var pos = new Point(( e.X / scalex ), ( e.Y / scaley ));
            Editor.ShowHurtMap = ShowHurtMap;
            Editor.ShowCollideMap = ShowCollideMap;

            if (Clicking) {
                if (!Editable) {
                    if (Click != null)
                        Click(pos);
                } else {
                    ClickHandled = true;
                    if (ShowHurtMap || ShowCollideMap)
                        Editor.CurrentColor = e.Right ? 0 : 1;
                    Editor.DrawLine(pos, LastPosition);
                    LastPosition = pos;
                }
            }
            return base.OnMouseOver(e);
        }
예제 #3
0
        public override bool OnMouseUp(Pointer e)
        {
            if (!Visible) return false;

            ClickHandled = false;
            Clicking = false;
            return base.OnMouseUp(e);
        }
예제 #4
0
 public override bool OnClick(Pointer e)
 {
     if (!Visible) return false;
     if (PieceLayoutMaker == null) return false;
     Clicking = true;
     ClickHandled = false;
     LastPosition = e;
     PieceLayoutMaker.PlaceItem(e, null);
     return base.OnClick(e);
 }
예제 #5
0
        public override bool OnMouseUp(Pointer e)
        {
            if (!Visible) return false;

            LastPosition = null;
            ClickHandled = false;
            Clicking = false;
            PieceLayoutMaker.MouseUp();
            return base.OnMouseUp(e);
        }
예제 #6
0
        public void MouseMove(Pointer cell)
        {
            if (lastPos.Falsey())
                return;

            xsp += ( lastPos.X - cell.X ) * 2.7f;
            ysp += ( lastPos.Y - cell.Y ) * 2.7f;
            xsp = ( ( xsp > 0 ? 1 : -1 ) * Math.Min(Math.Abs(xsp), 60) );
            ysp = ( ( ysp > 0 ? 1 : -1 ) * Math.Min(Math.Abs(ysp), 60) );
            lastPos = new Point(cell.X, cell.Y);
        }
예제 #7
0
        public override bool OnMouseOver(Pointer e)
        {
            if (PieceLayoutMaker == null) return false;

            if (Clicking) {
                ClickHandled = true;
                PieceLayoutMaker.PlaceItem(e, LastPosition);
                LastPosition = new Point(e.X, e.Y);
            }
            return base.OnMouseOver(e);
        }
예제 #8
0
        public override bool OnMouseOver(Pointer e)
        {
            if (Clicking) {
                var _x = ( e.X / Scale.X );
                var _y = ( e.Y / Scale.Y );

                if (Wide)
                    SelectedIndex = _y * Palette.Length / 2 + _x;
                else
                    SelectedIndex = _y * 2 + _x;
            }
            return base.OnMouseOver(e);
        }
예제 #9
0
        public bool OnClick(Pointer cell)
        {
            UIArea goodArea = null;
            var cl = ( UIAreas ).OrderBy((f) => -f.Depth);
            foreach (var are in cl) {
                if (are.Visible &&
                    ( are.IsEditMode()
                              ? are.Y - are.EditorEngine.MaxSize() <= cell.Y &&
                                are.Y + are.EditorEngine.MaxSize() + are.Height > cell.Y &&
                                are.X - are.EditorEngine.MaxSize() <= cell.X &&
                                are.X + are.EditorEngine.MaxSize() + are.Width > cell.X
                              : are.Y <= cell.Y &&
                                are.Y + are.Height > cell.Y &&
                                are.X <= cell.X &&
                                are.X + are.Width > cell.X )) {
                    goodArea = are;
                    var ec = new Pointer(cell.X - are.X, cell.Y - are.Y, 0, cell.Right);
                    are.OnClick(ec);
                    break;
                }
            }

            if (goodArea.Truthy()) {
                foreach (var are in UIAreas) {
                    if (goodArea == are) {
                        are.Depth = 1;
                        are.Focus(cell);
                    } else {
                        if (are.Visible) {
                            are.Depth = 0;
                            are.LoseFocus();
                        }
                    }
                }

                return true;
            } else {
                foreach (var are in UIAreas) {
                    if (are.Visible) {
                        are.Depth = 0;
                        are.LoseFocus();
                    }
                }
            }

            sonicManager.UIManager.dragger.Click(cell);
            return false;
        }
예제 #10
0
        public override bool OnClick(Pointer e)
        {
            if (!Visible) return false;
            Clicking = true;
            ClickHandled = false;

            var _x = ( e.X / Scale.X );
            var _y = ( e.Y / Scale.Y );

            if (Wide)
                SelectedIndex = _y * Palette.Length / 2 + _x;
            else
                SelectedIndex = _y * 2 + _x;

            return base.OnClick(e);
        }
예제 #11
0
        public override bool OnMouseUp(Pointer e)
        {
            if (!Visible) return false;
            Dragging = false;

            for (var ij = ScrollOffset; ij < Controls.Count; ij++) {
                var control = Controls[ij];
                if (control.Y <= e.Y && control.Y + control.Height > e.Y && control.X <= e.X + 2 && control.X + control.Width + 2 > e.X) {
                    e.X -= control.X;
                    e.Y -= control.Y;
                    control.OnMouseUp(e);
                    return true;
                }
            }

            if (MouseUp != null) MouseUp(new Point(e.X, e.Y));
            return base.OnMouseUp(e);
        }
예제 #12
0
        public override bool OnClick(Pointer e)
        {
            if (!Visible) return false;
            for (var ij = ScrollOffset; ij < Controls.Count; ij++) {
                var control = Controls[ij];
                if (control.Y <= e.Y && control.Y + control.Height > e.Y && control.X + 2 <= e.X && control.X + control.Width + 2 > e.X) {
                    e.X -= control.X;
                    e.Y -= control.Y;
                    control.OnClick(e);
                    return true;
                }
            }

            if (e.Y > ItemHeight && e.Y < ItemHeight + ScrollWidth) {
                var width = VisibleItems * ( ItemWidth + JWidth ) - 2;
                ScrollOffset = ( e.X / width ) * ( Controls.Count - VisibleItems );

                ScrollOffset = Math.Min(Math.Max(ScrollOffset, 0), Controls.Count);
            }
            Dragging = true;

            return base.OnClick(e);
        }
예제 #13
0
        private void canvasMouseMove(jQueryEvent queryEvent)
        {
            queryEvent.PreventDefault();
            Document.Body.Style.Cursor = "default";
            lastMouseMove = Help.GetCursorPosition(queryEvent);
            if (sonicManager.UIManager.OnMouseMove(lastMouseMove)) return;
            if (sonicManager.MouseMove(queryEvent)) return;

            return;
        }
예제 #14
0
 public void MouseUp(Pointer cell)
 {
     lastPos = null;
 }
예제 #15
0
 public bool IsDragging(Pointer cell)
 {
     return lastPos.Truthy();
 }
예제 #16
0
 public void Click(Pointer cell)
 {
     lastPos = new Point(cell.X, cell.Y);
 }
예제 #17
0
 public override void Focus(Pointer e)
 {
     _Focus();
     base.Focus(e);
 }
예제 #18
0
        public bool OnMouseScroll(jQueryEvent e)
        {
            
            int delta = e.Me().wheelDelta ? e.Me().wheelDelta / 40 : e.Me().detail ? -e.Me().detail : 0;

            var cell = Help.GetCursorPosition(e);

            foreach (var are in UIAreas) {
                if (are.Visible && are.Y <= cell.Y && are.Y + are.Height > cell.Y && are.X <= cell.X && are.X + are.Width > cell.X) {
                    var cell2 = new Pointer(cell.X - are.X, cell.Y - are.Y, delta, cell.Right);
                    return are.OnScroll(cell2);
                }
            }
            return false;
        }
예제 #19
0
        public override bool OnMouseUp(Pointer e)
        {
            if (!Visible) return false;
            if (Clicking) {}
            Clicking = false;
            if (MouseUp != null) MouseUp(new Point(e.X, e.Y));

            return base.OnMouseUp(e);
        }
예제 #20
0
        public override bool OnScroll(Pointer e)
        {
            if (!Visible) return false;

            if (e.Delta > 0) {
                if (ScrollOffset > 0)
                    ScrollOffset--;
            } else {
                if (ScrollOffset < Controls.Count - VisibleItems)
                    ScrollOffset++;
            }

            foreach (var control in Controls) {
                if (control.Y <= e.Y && control.Y + control.Height > e.Y && control.X <= e.X && control.X + control.Width > e.X) {
                    e.X -= control.X;
                    e.Y -= control.Y;
                    return true;
                }
            }
            //if (this.scroll) this.scroll();
            return true;
        }
예제 #21
0
        public override bool OnMouseOver(Pointer e)
        {
            if (!Visible) return false;
            foreach (var control in Controls) {
                if (control.Y <= e.Y && control.Y + control.Height > e.Y && control.X + 2 <= e.X && control.X + control.Width + 2 > e.X) {
                    e.X -= control.X;
                    e.Y -= control.Y;
                    control.OnMouseOver(e);
                    break;
                }
            }
            if (Dragging && e.Y > ItemHeight && e.Y < ItemHeight + ScrollWidth) {
                var width = VisibleItems * ( ItemWidth + JWidth ) - 2;
                ScrollOffset = (int) ( ( (double) e.X / width ) * ( Controls.Count - VisibleItems ) );

                ScrollOffset = Math.Min(Math.Max(ScrollOffset, 0), Controls.Count);
            }
            if (MouseOver != null) MouseOver(new Point(e.X, e.Y));
            return base.OnMouseOver(e);
        }
예제 #22
0
 public override bool OnMouseOver(Pointer e)
 {
     if (MouseOver != null) MouseOver(new Point(e.X, e.Y));
     return base.OnMouseOver(e);
 }
예제 #23
0
 public bool MouseUp(Pointer e)
 {
     foreach (var j in points) {
         j.Editing = false;
     }
     Editing = false;
     Dragging = false;
     StartDragging = null;
     dragg = null;
     return false;
 }
예제 #24
0
        public bool Click(Pointer e)
        {
            var x = 0;
            var y = 0;
            var w = Element.Width;
            var h = Element.Height;

            //uiManager.propertyList.populate(this.Element);

            foreach (var j in points) {
                j.Editing = false;
            }

            foreach (var j in points) {
                var sz = j.Size * 5;

                var rect = new Rectangle(x + ( w * j.X / 100 ) - sz / 2, y + ( h * j.Y / 100 ) - sz / 2, sz, sz);

                if (e.X > rect.X && e.X < rect.X + rect.Width && e.Y > rect.Y && e.Y < rect.Y + rect.Height) {
                    Document.Body.Style.Cursor = j.Cursor;
                    StartDragging = new Point(e.X, e.Y);
                    Editing = true;
                    j.Editing = true;
                    return true;
                }
            }

            if (e.X > x && e.X < x + w && e.Y > y && e.Y < y + h) {
                dragg = new Point(e.X, e.Y);
                Document.Body.Style.Cursor = "move";
                Dragging = true;
                return false;
            } else
                Document.Body.Style.Cursor = "default";
            return false;
        }
예제 #25
0
        public bool OnMouseMove(Pointer cell)
        {
            var cl = ( UIAreas ).OrderBy((f) => { return -f.Depth; });

            foreach (var are in cl) {
                if (are.Dragging.Truthy() || are.IsEditMode() || ( are.Visible && are.Y <= cell.Y &&
                                                                   are.Y + are.Height > cell.Y &&
                                                                   are.X <= cell.X &&
                                                                   are.X + are.Width > cell.X )) {
                    var cell2 = new Pointer(cell.X - are.X, cell.Y - are.Y, 0, cell.Right);
                    return are.OnMouseOver(cell2);
                }
            }

            if (dragger.IsDragging(cell)) {
                dragger.MouseMove(cell);
                return false;
            }
            dragger.MouseMove(cell);

            return false;
        }
예제 #26
0
        public override bool OnScroll(Pointer e)
        {
            PieceLayoutMaker.OffsetScale(e.Delta > 0);

            return false;
        }
예제 #27
0
        public override bool OnMouseOver(Pointer e)
        {
            if (!Visible) return false;
            Document.Body.Style.Cursor = "text";
            if (Clicking) {
                if (DragPosition == -1)
                    DragPosition = CursorPosition;
                can.Save();

                if (can.Font != Font)
                    can.Font = Font;
                for (var i = 0; i < Text.Length; i++) {
                    var w = can.MeasureText(Text.Substring(0, i)).Width;
                    if (w > e.X - 14) {
                        CursorPosition = i;
                        return false;
                    }
                }
                can.Restore();

                CursorPosition = Text.Length;
            }
            if (MouseOver != null) MouseOver(new Point(e.X, e.Y));
            return base.OnMouseOver(e);
        }
예제 #28
0
 public override bool OnClick(Pointer e)
 {
     return false;
 }
예제 #29
0
        public bool MouseOver(Pointer e)
        {
            var x = 0;
            var y = 0;
            var w = Element.Width;
            var h = Element.Height;

            Document.Body.Style.Cursor = "move";
            if (Dragging) {
/*
                if (this.Element.ChildrenAreEditing())
                {
                    return false;
                }
*/
                var jx = e.X - dragg.X;
                var jy = e.Y - dragg.Y;
                Element.X += jx;
                Element.Y += jy;

                /*   window.DEBUGLABELS[0] = "E: " + e.X + " " + e.Y;
                   window.DEBUGLABELS[1] = "Dragg: " + this.dragg.X + " " + this.dragg.Y;
                   window.DEBUGLABELS[2] = "Element: " + this.Element.X + " " + this.Element.Y;
                   window.DEBUGLABELS[3] = "Offset: " + jx + " " + jy;*/
                //this.dragg.x += jx;
                //this.dragg.y += jy;

                return false;
            }
            foreach (var j in points) {
                var sz = j.Size * 5;

                if (j.Editing) {
                    Document.Body.Style.Cursor = j.Cursor;
                    var dv = new Point(StartDragging.X - e.X, StartDragging.Y - e.Y);

                    j.Click(dv);
                    StartDragging = new Point(e.X + dv.X, e.Y + dv.Y);
                    return true;
                }

                var rect = new Rectangle(x + ( w * j.X / 100 ) - sz / 2, y + ( h * j.Y / 100 ) - sz / 2, sz, sz);

                if (e.X > rect.X && e.X < rect.X + rect.Width && e.Y > rect.Y && e.Y < rect.Y + rect.Height) {
                    Document.Body.Style.Cursor = j.Cursor;

                    if (j.Editing) {
                        var dv = new Point(StartDragging.X - e.X, StartDragging.Y - e.Y);

                        j.Click(dv);
                        StartDragging = new Point(e.X + dv.X, e.Y + dv.Y);
                    }
                    return true;
                }
            }

            StartDragging = new Point(e.X, e.Y);
            return Editing;
        }
예제 #30
0
        public void OnMouseUp(Pointer cell)
        {
            foreach (var are in UIAreas) {
                var ec = new Pointer(cell.X - are.X, cell.Y - are.Y, 0, cell.Right);
                are.OnMouseUp(ec);
            }

            dragger.MouseUp(cell);
        }