Add Settings interface (#32352)

Add test for settings on paper and new created PaperScope instance
This commit is contained in:
AntoineC
2019-01-29 00:16:51 +01:00
committed by Pranav Senthilnathan
parent 78feba7772
commit 4a91c57f19
2 changed files with 25 additions and 27 deletions

View File

@@ -21,26 +21,7 @@ declare module paper {
/**
* Gives access to paper's configurable settings.
*/
export var settings: {
/**
* controls whether newly created items are automatically inserted into the scene graph, by adding them to project.activeLayer — default: true
*/
insertItems: boolean;
/**
* controls what value newly created items have their item.applyMatrix property set to (Note that not all items can set this to false) — default: true
*/
applyMatrix: boolean;
/**
* the size of the curve handles when drawing selections — default: 4
*/
handleSize: number;
/*
* the default tolerance for hit- tests, when no value is specified — default: 0
*/
hitTolerance: number;
};
export var settings: Settings;
/**
* The currently active project.
@@ -1163,13 +1144,7 @@ declare module paper {
/**
* Gives access to paper's configurable settings.
*/
settings: {
applyMatrix: boolean;
handleSize: number;
hitTolerance: number;
};
settings: Settings;
/**
* The currently active project.
@@ -5481,6 +5456,25 @@ declare module paper {
type: 'mousedown' | 'mouseup' | 'mousedrag' | 'click' | 'doubleclick' | 'mousemove' | 'mouseenter' | 'mouseleave';
}
export interface Settings {
/**
* controls whether newly created items are automatically inserted into the scene graph, by adding them to project.activeLayer — default: true
*/
insertItems: boolean;
/**
* controls what value newly created items have their item.applyMatrix property set to (Note that not all items can set this to false) — default: true
*/
applyMatrix: boolean;
/**
* the size of the curve handles when drawing selections — default: 4
*/
handleSize: number;
/*
* the default tolerance for hit- tests, when no value is specified — default: 0
*/
hitTolerance: number;
}
}
declare module 'paper'

View File

@@ -81,6 +81,10 @@ hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceFull)
paper.view.scaling = new paper.Point(1, 1);
paper.settings.insertItems = true
const paperScope = new paper.PaperScope();
paperScope.settings.insertItems = false;
function Examples() {
function BooleanOperations(){
let text = new paper.PointText({