New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@idraw/core

Package Overview
Dependencies
Maintainers
0
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@idraw/core - npm Package Compare versions

Comparing version 0.4.0-beta.31 to 0.4.0-beta.32

4

dist/esm/middleware/layout-selector/config.d.ts

@@ -0,1 +1,2 @@

import type { MiddlewareLayoutSelectorStyle } from '@idraw/types';
export declare const key = "LAYOUT_SELECT";

@@ -7,4 +8,3 @@ export declare const keyLayoutActionType: unique symbol;

export declare const keyLayoutIsSelected: unique symbol;
export declare const selectColor = "#b331c9";
export declare const disableColor = "#5b5959b5";
export declare const controllerSize = 10;
export declare const defaultStyle: MiddlewareLayoutSelectorStyle;

@@ -7,4 +7,5 @@ export const key = 'LAYOUT_SELECT';

export const keyLayoutIsSelected = Symbol(`${key}_layoutIsSelected`);
export const selectColor = '#b331c9';
export const disableColor = '#5b5959b5';
export const controllerSize = 10;
export const defaultStyle = {
activeColor: '#b331c9'
};

@@ -1,5 +0,5 @@

import type { BoardMiddleware } from '@idraw/types';
import type { BoardMiddleware, MiddlewareLayoutSelectorConfig } from '@idraw/types';
import type { LayoutSelectorSharedStorage } from './types';
import { keyLayoutIsSelected } from './config';
export { keyLayoutIsSelected };
export declare const MiddlewareLayoutSelector: BoardMiddleware<LayoutSelectorSharedStorage>;
export declare const MiddlewareLayoutSelector: BoardMiddleware<LayoutSelectorSharedStorage, any, MiddlewareLayoutSelectorConfig>;
import { calcLayoutSizeController, isViewPointInVertexes, getViewScaleInfoFromSnapshot, isViewPointInElementSize, calcViewElementSize } from '@idraw/util';
import { keyLayoutActionType, keyLayoutController, keyLayoutControlType, keyLayoutIsHover, keyLayoutIsSelected, controllerSize } from './config';
import { keyLayoutActionType, keyLayoutController, keyLayoutControlType, keyLayoutIsHover, keyLayoutIsSelected, controllerSize, defaultStyle } from './config';
import { keyActionType as keyElementActionType, keyHoverElement, middlewareEventSelectClear } from '../selector';

@@ -7,5 +7,8 @@ import { drawLayoutController, drawLayoutHover } from './util';

export { keyLayoutIsSelected };
export const MiddlewareLayoutSelector = (opts) => {
export const MiddlewareLayoutSelector = (opts, config) => {
const { sharer, boardContent, calculator, viewer, eventHub } = opts;
const { overlayContext } = boardContent;
const innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
const { activeColor } = innerConfig;
const style = { activeColor };
let prevPoint = null;

@@ -316,6 +319,6 @@ let prevIsHover = null;

const viewSize = calcViewElementSize(size, { viewScaleInfo });
drawLayoutHover(overlayContext, { layoutSize: viewSize });
drawLayoutHover(overlayContext, { layoutSize: viewSize, style });
}
if ((layoutActionType && ['resize'].includes(layoutActionType)) || layoutIsSelected === true) {
drawLayoutController(overlayContext, { controller, operations: activeStore.data.layout.operations || {} });
drawLayoutController(overlayContext, { controller, style });
}

@@ -322,0 +325,0 @@ }

@@ -1,8 +0,9 @@

import type { ViewContext2D, LayoutSizeController, DataLayout, ElementSize } from '@idraw/types';
import type { ViewContext2D, LayoutSizeController, ElementSize, MiddlewareLayoutSelectorStyle } from '@idraw/types';
export declare function drawLayoutController(ctx: ViewContext2D, opts: {
controller: LayoutSizeController;
operations: DataLayout['operations'];
style: MiddlewareLayoutSelectorStyle;
}): void;
export declare function drawLayoutHover(ctx: ViewContext2D, opts: {
layoutSize: ElementSize;
style: MiddlewareLayoutSelectorStyle;
}): void;

@@ -1,3 +0,3 @@

import { selectColor, disableColor } from './config';
function drawControllerBox(ctx, boxVertexes) {
function drawControllerBox(ctx, boxVertexes, style) {
const { activeColor } = style;
ctx.setLineDash([]);

@@ -12,3 +12,3 @@ ctx.fillStyle = '#FFFFFF';

ctx.fill();
ctx.strokeStyle = selectColor;
ctx.strokeStyle = activeColor;
ctx.lineWidth = 2;

@@ -23,22 +23,7 @@ ctx.beginPath();

}
function drawControllerCross(ctx, opts) {
const { vertexes, strokeStyle, lineWidth } = opts;
ctx.setLineDash([]);
ctx.strokeStyle = strokeStyle;
ctx.lineWidth = lineWidth;
ctx.beginPath();
ctx.moveTo(vertexes[0].x, vertexes[0].y);
ctx.lineTo(vertexes[2].x, vertexes[2].y);
ctx.closePath();
ctx.stroke();
ctx.beginPath();
ctx.moveTo(vertexes[1].x, vertexes[1].y);
ctx.lineTo(vertexes[3].x, vertexes[3].y);
ctx.closePath();
ctx.stroke();
}
function drawControllerLine(ctx, opts) {
const { start, end, centerVertexes, disabled } = opts;
const lineWidth = disabled === true ? 1 : 2;
const strokeStyle = disabled === true ? disableColor : selectColor;
const { start, end, style } = opts;
const { activeColor } = style;
const lineWidth = 2;
const strokeStyle = activeColor;
ctx.setLineDash([]);

@@ -52,51 +37,21 @@ ctx.strokeStyle = strokeStyle;

ctx.stroke();
if (disabled === true) {
drawControllerCross(ctx, {
vertexes: centerVertexes,
lineWidth,
strokeStyle
});
}
}
export function drawLayoutController(ctx, opts) {
const { controller, operations } = opts;
const { controller, style } = opts;
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledTop) });
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledRight) });
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledBottom) });
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledLeft) });
const disabledOpts = {
lineWidth: 1,
strokeStyle: disableColor
};
if ((operations === null || operations === void 0 ? void 0 : operations.disabledTopLeft) === true) {
drawControllerCross(ctx, Object.assign({ vertexes: topLeft.vertexes }, disabledOpts));
}
else {
drawControllerBox(ctx, topLeft.vertexes);
}
if ((operations === null || operations === void 0 ? void 0 : operations.disabledTopRight) === true) {
drawControllerCross(ctx, Object.assign({ vertexes: topRight.vertexes }, disabledOpts));
}
else {
drawControllerBox(ctx, topRight.vertexes);
}
if ((operations === null || operations === void 0 ? void 0 : operations.disabledBottomRight) === true) {
drawControllerCross(ctx, Object.assign({ vertexes: bottomRight.vertexes }, disabledOpts));
}
else {
drawControllerBox(ctx, bottomRight.vertexes);
}
if ((operations === null || operations === void 0 ? void 0 : operations.disabledBottomLeft) === true) {
drawControllerCross(ctx, Object.assign({ vertexes: bottomLeft.vertexes }, disabledOpts));
}
else {
drawControllerBox(ctx, bottomLeft.vertexes);
}
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, style });
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, style });
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, style });
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, style });
drawControllerBox(ctx, topLeft.vertexes, style);
drawControllerBox(ctx, topRight.vertexes, style);
drawControllerBox(ctx, bottomRight.vertexes, style);
drawControllerBox(ctx, bottomLeft.vertexes, style);
}
export function drawLayoutHover(ctx, opts) {
const { layoutSize } = opts;
const { layoutSize, style } = opts;
const { activeColor } = style;
const { x, y, w, h } = layoutSize;
ctx.setLineDash([]);
ctx.strokeStyle = selectColor;
ctx.strokeStyle = activeColor;
ctx.lineWidth = 1;

@@ -103,0 +58,0 @@ ctx.beginPath();

@@ -104,3 +104,2 @@ import { is, calcElementsViewInfo, calcElementVertexesInGroup, calcElementQueueVertexesQueueInGroup, calcElementSizeController, calcElementCenterFromVertexes, rotatePointInGroup, getGroupQueueFromList, findElementsFromList, findElementsFromListByPositions, getElementPositionFromList, deepResizeGroupElement } from '@idraw/util';

sharer.setSharedStorage(keyIsMoving, null);
sharer.setSharedStorage(keyEnableSelectInGroup, null);
};

@@ -107,0 +106,0 @@ clear();

{
"name": "@idraw/core",
"version": "0.4.0-beta.31",
"version": "0.4.0-beta.32",
"description": "",

@@ -24,9 +24,9 @@ "main": "dist/esm/index.js",

"devDependencies": {
"@idraw/types": "^0.4.0-beta.31"
"@idraw/types": "^0.4.0-beta.32"
},
"dependencies": {},
"peerDependencies": {
"@idraw/board": "^0.4.0-beta.31",
"@idraw/renderer": "^0.4.0-beta.31",
"@idraw/util": "^0.4.0-beta.31"
"@idraw/board": "^0.4.0-beta.32",
"@idraw/renderer": "^0.4.0-beta.32",
"@idraw/util": "^0.4.0-beta.32"
},

@@ -33,0 +33,0 @@ "publishConfig": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc