Ejemplo n.º 1
0
        public FunctionGraph()
        {
            InitializeComponent();
            _backgroundColor  = Background.SolidColor();
            _foregroundColor  = Foreground.SolidColor();
            Canvas.ClearColor = _backgroundColor;

            ManipulationMode =
                ManipulationModes.Scale
                | ManipulationModes.TranslateX
                | ManipulationModes.TranslateY
                | ManipulationModes.TranslateInertia
                | ManipulationModes.ScaleInertia;

            _dispatcher     = Window.Current.Dispatcher;
            _currentStrokes = _rootStrokes;

            InkPresenter inkPresenter = InkInput.InkPresenter;

            inkPresenter.UpdateDefaultDrawingAttributes(new InkDrawingAttributes()
            {
                Size  = new Size(4, 4),
                Color = _foregroundColor
            });

            CoreInkIndependentInputSource coreInputSource = CoreInkIndependentInputSource.Create(inkPresenter);

            coreInputSource.PointerMoving   += CoreInputSource_PointerMoving;
            coreInputSource.PointerPressing += CoreInputSource_PointerPressing;

            _inkInputProcessing            = inkPresenter.InputProcessingConfiguration;
            inkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            _inkSynchronizer = inkPresenter.ActivateCustomDrying();

            SizeChanged += (s, e) => ReduceFunctionDetail();
            RegisterPropertyChangedCallback(BackgroundProperty, OnBackgroundChanged);
            RegisterPropertyChangedCallback(ForegroundProperty, OnForegroundChanged);
        }